On Wed, Feb 6, 2013 at 11:42 PM, Merlin Moncure <mmonc...@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.

Reply via email to