pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim@mcdee.net
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12644: Planner fails to use available index with anything other than default operator
Date: Sat, 24 Jan 2015 10:01:31 -0500
Message-ID: <16692.1422111691@sss.pgh.pa.us> (raw)
In-Reply-To: <20150123181759.32669.55573@wrigleys.postgresql.org>
References: <20150123181759.32669.55573@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (4+ messages)  latest in thread

Message-ID: <16692.1422111691@sss.pgh.pa.us>
Permalink:  ../16692.1422111691@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16692.1422111691@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Jim@mcdee.net
  Subject: Re: BUG #12644: Planner fails to use available index with anything other than default operator
  In-Reply-To: <16692.1422111691@sss.pgh.pa.us>
  References: <20150123181759.32669.55573@wrigleys.postgresql.org> <16692.1422111691@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox