Re: Alias hstore's ? to ~ so that it works with JDBC

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Seamus Abshere <seamus(at)abshere(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Alias hstore's ? to ~ so that it works with JDBC
Date: 2013-02-07 05:14:40
Message-ID: CAPpHfdvsvzeAsG8__kA1W7kuR4Fi4y3T0Yb1MYZpVCR+2h_=zg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 6, 2013 at 11:42 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:

> >> *) hacking pg_operator (carefully look up and change oprname for the
> >> specific hstore operator)
> >
> >
> > bad solution. Why not just provide an additional operator?
> >
> > CREATE OPERATOR ~ (
> > LEFTARG = hstore,
> > RIGHTARG = text,
> > PROCEDURE = exist,
> > RESTRICT = contsel,
> > JOIN = contjoinsel
> > );
>
> yeah, this is much less hacky way to go.
>

But, you need to add new operator to opclasses in order to use GiST and GIN
indexes.
Another solution is to create SQL functionw which calls operator:
CREATE FUNCTION exists_inline (hstore, text) RETURNS bool AS $$ SELECT $1 ?
$2; $$ LANGUAGE sql;
It will inline and use indexes.

------
With best regards,
Alexander Korotkov.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2013-02-07 05:39:18 Vacuum/visibility is busted
Previous Message Seamus Abshere 2013-02-07 03:33:01 Re: Alias hstore's ? to ~ so that it works with JDBC