Re: CAST Within EXCLUSION constraint

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CAST Within EXCLUSION constraint
Date: 2013-08-20 16:53:54
Message-ID: 6BFFDFDB-24B2-41D6-9B05-9237BE9CF271@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Aug 20, 2013, at 6:50 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> You need more parentheses -- (source::text) would've worked.

Alas, no, same problem as for CAST():

ERROR: functions in index expression must be marked IMMUTABLE

>> No problem, I can use CAST(), right? So I try:
>> EXCLUDE USING gist (CAST(source AS text) WITH =, within WITH &&)
>> Not so much:
>> try.sql:13: ERROR: functions in index expression must be marked IMMUTABLE
>> I guess it's because locale settings might change, and therefore change the text representation? Seems unlikely, though.
>
> Not locale, just renaming one of the values would be enough to break that.
> Admittedly we don't provide an official way to do that ATM, but you can do
> an UPDATE on pg_enum.

Ah, right. Maybe if there was a way to get at some immutable numeric value…

Thanks,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-08-20 18:02:51 Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])
Previous Message Tom Lane 2013-08-20 16:50:11 Re: CAST Within EXCLUSION constraint