Re: BUG #4421: convert_to() should be immutable

Поиск
Список
Период
Сортировка
От Andreas Peer
Тема Re: BUG #4421: convert_to() should be immutable
Дата
Msg-id 48D20645.1090503@gmx.net
обсуждение исходный текст
Ответ на Re: BUG #4421: convert_to() should be immutable  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #4421: convert_to() should be immutable  (Peter Eisentraut <peter_e@gmx.net>)
Re: BUG #4421: convert_to() should be immutable  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Tom Lane wrote:
> Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
>
>> andipeer@gmx.net wrote:
>>
>>> The function convert_to(string text, dest_encoding name) is not allowed to
>>> be used in a index expression, because it is not marked as "IMMUTABLE".
>>>
>
>
>> You can change the way a conversion is done with CREATE/DROP CONVERSION.
>> That's why it can't be IMMUTABLE.
>>
>
> The other reason is that it depends on the database encoding.  I suppose
> you could make an argument that that's fixed for as long as IMMUTABLE
> needs to think about --- but we'd have to remember to undo the marking
> if database encoding ever becomes less fixed.
>
> Just out of curiosity, what's the use-case for this function in an index
> anyway?
>
>             regards, tom lane
>
>
Thank you all for the responses!
Well, the use case is a strange one... I would like to use a varchar()
column for storing a variable-length vector of integers. The numbers are
represented by the codepoints. Therefore, I need to sort them as binary
data, not as characters. I would often need to get all the vectors that
lie in between to vectors, therefore I need the "binary" index.
And the code should be as database independent as possible, therefore I
cannot use an array or another data type that may not be supported by
other DBMS.

Regards,
Andreas Peer

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

Предыдущее
От: ITAGAKI Takahiro
Дата:
Сообщение: Re: [HACKERS] 0x1A in control file on Windows
Следующее
От: "Abdul Rehman"
Дата:
Сообщение: BUG #4423: Impementing replication via pgadmin