Re: CAST Within EXCLUSION constraint

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: CAST Within EXCLUSION constraint
Дата
Msg-id 6BFFDFDB-24B2-41D6-9B05-9237BE9CF271@justatheory.com
обсуждение исходный текст
Ответ на Re: CAST Within EXCLUSION constraint  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: CAST Within EXCLUSION constraint
Список pgsql-hackers
On Aug 20, 2013, at 6:50 PM, Tom Lane <tgl@sss.pgh.pa.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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: CAST Within EXCLUSION constraint
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])