Re: Alias hstore's ? to ~ so that it works with JDBC - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: Alias hstore's ? to ~ so that it works with JDBC
Date
Msg-id CAPpHfdvsvzeAsG8__kA1W7kuR4Fi4y3T0Yb1MYZpVCR+2h_=zg@mail.gmail.com
Whole thread Raw
In response to Re: Alias hstore's ? to ~ so that it works with JDBC  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
On Wed, Feb 6, 2013 at 11:42 PM, Merlin Moncure <mmoncure@gmail.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.

pgsql-hackers by date:

Previous
From: Seamus Abshere
Date:
Subject: Re: Alias hstore's ? to ~ so that it works with JDBC
Next
From: Jeff Janes
Date:
Subject: Vacuum/visibility is busted