Re: BUG #5126: convert_to preventing index scan
От | Andrew Gierth |
---|---|
Тема | Re: BUG #5126: convert_to preventing index scan |
Дата | |
Msg-id | 87zl7jlu0f.fsf@news-spur.riddles.org.uk обсуждение исходный текст |
Ответ на | Re: BUG #5126: convert_to preventing index scan (Peter Eisentraut <peter_e@gmx.net>) |
Ответы |
Re: BUG #5126: convert_to preventing index scan
|
Список | pgsql-bugs |
>>>>> "Peter" == Peter Eisentraut <peter_e@gmx.net> writes: >> I have table with bytea column, which is indexed (1) >> I want to use index during pattern matching (eg. dir like >> someDirectoryName >> || '/%'), but concatenation of two strings cause error (2) >> So I have to use function convert_to (converting text to bytea), but >> this >> has awful explain plan (3) Peter> You haven't told us how the convert_to function is defined. convert_to is a builtin function. If there's a bug here, it's that convert_to is defined as stable rather than immutable. (Sure it depends on server_encoding, but that can't exactly change... if there's any other reason why it's not immutable, I can't think what it is.) Example (5) from the original message is the correct approach in any case; as long as either operand of the || is explicitly passed as, or cast to, a bytea, then it should work. -- Andrew (irc:RhodiumToad)
В списке pgsql-bugs по дате отправления: