[postgis-devel] Death to Pointless Operators
Paragon Corporation
lr at pcorp.us
Sat Dec 25 08:34:01 PST 2010
> I'm not sure that "overloading =" is going to be possible. We already
> have a 'geometry = geometry' operator defined, in the btree opclass.
> When I try to define another 'geometry = geometry' under gist, it says
> there is already an '=' operator. And we need the '=' under btree if
> we are to get 'group by' working the way we want, right? Or will any
> '=' operator do for 'group by'?
> P.
Happy Holidays all!
Paul,
I'm trying to figure out how the ltree folks get away with it. I'm looking
at a 9.0
Database I have that has ltree installed. I can do group by and order by
an ltree object fine.
Hope this helps.
It looks like they just have one = operator defined like so:
CREATE OPERATOR =(
PROCEDURE = ltree_eq,
LEFTARG = ltree,
RIGHTARG = ltree,
COMMUTATOR = =,
RESTRICT = eqsel,
JOIN = eqjoinsel,
MERGES);
But both there gist and btree classes contain that operator:
CREATE OPERATOR CLASS gist_ltree_ops DEFAULT
FOR TYPE ltree USING gist AS
OPERATOR 1 <,
OPERATOR 2 <=,
OPERATOR 3 =,
OPERATOR 4 >=,
OPERATOR 5 >,
OPERATOR 10 @>,
OPERATOR 11 <@,
OPERATOR 12 ~(ltree, lquery),
OPERATOR 13 ~(lquery, ltree),
OPERATOR 14 @(ltree, ltxtquery),
OPERATOR 15 @(ltxtquery, ltree),
OPERATOR 16 ?(ltree, _lquery),
OPERATOR 17 ?(_lquery, ltree),
FUNCTION 1 ltree_consistent(internal, internal, smallint, oid,
internal),
FUNCTION 2 ltree_union(internal, internal),
FUNCTION 3 ltree_compress(internal),
FUNCTION 4 ltree_decompress(internal),
FUNCTION 5 ltree_penalty(internal, internal, internal),
FUNCTION 6 ltree_picksplit(internal, internal),
FUNCTION 7 ltree_same(internal, internal, internal)
STORAGE ltree_gist;
CREATE OPERATOR CLASS contribs.ltree_ops DEFAULT
FOR TYPE ltree USING btree AS
OPERATOR 1 <,
OPERATOR 2 <=,
OPERATOR 3 =,
OPERATOR 4 >=,
OPERATOR 5 >,
FUNCTION 1 ltree_cmp(ltree, ltree);
-- they also have this curious one which I assume is so they can do compares
between ltree query expressions and ltree objects
-- so this one is probably not relevant for our purposes
CREATE OPERATOR CLASS gist__ltree_ops DEFAULT
FOR TYPE _ltree USING gist AS
OPERATOR 10 <@(_ltree, ltree),
OPERATOR 11 @>(ltree, _ltree),
OPERATOR 12 ~(_ltree, lquery),
OPERATOR 13 ~(lquery, _ltree),
OPERATOR 14 @(_ltree, ltxtquery),
OPERATOR 15 @(ltxtquery, _ltree),
OPERATOR 16 ?(_ltree, _lquery),
OPERATOR 17 ?(_lquery, _ltree),
FUNCTION 1 _ltree_consistent(internal, internal, smallint, oid,
internal),
FUNCTION 2 _ltree_union(internal, internal),
FUNCTION 3 _ltree_compress(internal),
FUNCTION 4 ltree_decompress(internal),
FUNCTION 5 _ltree_penalty(internal, internal, internal),
FUNCTION 6 _ltree_picksplit(internal, internal),
FUNCTION 7 _ltree_same(internal, internal, internal)
STORAGE ltree_gist;
Hope that helps,
Regina
More information about the postgis-devel
mailing list