Re: BUG #12644: Planner fails to use available index with anything other than default operator

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #12644: Planner fails to use available index with anything other than default operator
Дата
Msg-id 16692.1422111691@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #12644: Planner fails to use available index with anything other than default operator  (Jim@mcdee.net)
Ответы Re: BUG #12644: Planner fails to use available index with anything other than default operator  (Jim McDonald <Jim@mcdee.net>)
Список pgsql-bugs
Jim@mcdee.net writes:
> Using psql I can run a simple select and it uses the index as expected:
>     EXPLAIN ANALYZE SELECT d FROM jsonthings WHERE d->'name' ? 'First';

> However I cannot use the '?' operator because I'm accessing the database
> through JDBC and there is no way to escape the '?' character.

Seems to me you need to discuss that problem with the pgsql-jdbc folk.
(I suspect they have some solution already, because operators whose names
contain '?' have been around for a very very long time.)

> Instead I attempted to use the functino which underpins the '?'
> operator, however it is not using the index:

Nope, this doesn't work, never has, and will not in the foreseeable
future.  Index access is defined in terms of operators, not other
ways to access the same function; see
http://www.postgresql.org/docs/9.4/static/indexes-opclass.html

Possibly the Berkeley crew should have done it the other way;
but they didn't, and we're unlikely to try to move that mountain
now.

            regards, tom lane

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: BUG #12650: user defined exception
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #12644: Planner fails to use available index with anything other than default operator