Re: New data type: uniqueidentifier - Mailing list pgsql-hackers

From Dmitry G. Mastrukov
Subject Re: New data type: uniqueidentifier
Date
Msg-id 001301c0ff57$7878e380$016ba8c0@taurussoft.org
Whole thread Raw
In response to Re: New data type: uniqueidentifier  (Alex Pilosov <alex@pilosoft.com>)
Responses Re: New data type: uniqueidentifier  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Alex Pilosov <alex@pilosoft.com> wrote:
> On Tue, 26 Jun 2001, Dmitry G. Mastrukov wrote:
>
> > myself some things.
> > I've marked "=" operator with HASH clause (and planner has started to
use
> > hash jons). But as I understand the right way is to create special hash
> > function (may be wrapper for hash_any(), isn't it?) and register it for
hash
> > as for btree method.
>
> No. Currently, there's no way to specify a hash function for a given
> operator, it always uses a builtin function that operates on memory
> representation of a value.
>
> There's no need (or possibility) to register a hash with btree method.
>
Strange. When I execute following query (slightly modified query from User's
Guide chapter 7.6)

SELECT am.amname AS acc_name,      opc.opcname AS ops_name,      opr.oprname AS ops_comp   FROM pg_am am, pg_amop amop,
      pg_opclass opc, pg_operator opr   WHERE amop.amopid = am.oid AND         amop.amopclaid = opc.oid AND
amop.amopopr= opr.oid   ORDER BY ops_name, ops_comp;
 

I see both hash and btree amname for builtin opclasses. For example
acc_name | ops_name | ops_comp
----------+----------+----------btree    | int4_ops | <btree    | int4_ops | <=btree    | int4_ops | =hash     |
int4_ops| =btree    | int4_ops | >btree    | int4_ops | >=
 

But new type has no hash for "=". Plus I saw hash functions for builtin
types in source code. So can I achieve for created type such intergration
with Postgres as for builtin types? Or am I understanding something wrong?

regards,
Dmitry



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_largeobject is a security hole
Next
From: Hannu Krosing
Date:
Subject: Re: functions returning records