Operator Class for Hash

From: "Jozsef Szalay" <jszalay(at)storediq(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Operator Class for Hash
Date: 2006-04-30 15:21:21
Message-ID: E387E2E9622FDD408359F98BF183879E3D9DEF@dc1.storediq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

Could someone please help me out with an example on how to define an
operator and operator class that supports hash joins? I've tried to
follow the instructions in the documentation for v8.1 but I'm obviously
doing something wrong, because the engine crashes on an operation that
tries to use the operator.

Here is what I have:

CREATE OPERATOR < (leftarg = mytype, rightarg = mytype, procedure =
mytype_lt, commutator = >, negator = >=, restrict = scalarltsel, join =
scalarltjoinsel, HASHES);

CREATE OPERATOR <= (leftarg = mytype, rightarg = mytype, procedure =
mytype_le, commutator = >=, negator = >, restrict = scalarltsel, join =
scalarltjoinsel, HASHES, sort1 = <, sort2 = <);

CREATE OPERATOR = (leftarg = mytype, rightarg = mytype, procedure =
mytype_eq, commutator = =, negator = <>, restrict = eqsel, join =
eqjoinsel, HASHES, sort1 = <, sort2 = <);

CREATE OPERATOR >= (leftarg = mytype, rightarg = mytype, procedure =
mytype_ge, commutator = <=, negator = <, restrict = scalargtsel, join =
scalargtjoinsel, HASHES, sort1 = <, sort2 = <);

CREATE OPERATOR > (leftarg = mytype, rightarg = mytype, procedure =
mytype_gt, commutator = <, negator = <=, restrict = scalargtsel, join =
scalargtjoinsel, HASHES, sort1 = <, sort2 = <);

CREATE OPERATOR <> (leftarg = mytype, rightarg = mytype, procedure =
mytype_ne, commutator = <>, negator = =, restrict = neqsel, join =
neqjoinsel, HASHES, sort1 = <, sort2 = <);

CREATE OPERATOR CLASS mytype_ops DEFAULT FOR TYPE mytype USING btree AS

OPERATOR 1 <,

OPERATOR 2 <=,

OPERATOR 3 =,

OPERATOR 4 >=,

OPERATOR 5 >,

FUNCTION 1 mytype_comp(mytype, mytype);

CREATE OPERATOR CLASS mytype_ops DEFAULT FOR TYPE mytype USING hash AS

OPERATOR 1 =,

FUNCTION 1 mytype_comp(mytype, mytype);

Thank you for the help!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomi NA 2006-04-30 15:57:48 Re: Is PostgreSQL an easy choice for a large CMS?
Previous Message chris smith 2006-04-30 13:21:55 Re: Is PostgreSQL an easy choice for a large CMS?