Re: Custom type, operators and operator class not sorting/indexing correctly

From: Roger Leigh <rleigh(at)codelibre(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Custom type, operators and operator class not sorting/indexing correctly
Date: 2009-01-21 10:48:09
Message-ID: 20090121104809.GA1029@codelibre.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 21, 2009 at 02:03:03AM -0500, Tom Lane wrote:
> Roger Leigh <rleigh(at)codelibre(dot)net> writes:
> > I've created a new domain (debversion) derived from TEXT, which
> > includes its own operators (< <= = >= > and <>), and also its
> > own operator class for BTREE indices.
>
> You can't realistically attach such things to a domain; try making
> a separate type, perhaps with an implicit cast to text to allow
> use of text operators for other purposes.

Ah, thanks for the clarification. So I need to use CREATE TYPE
rather than CREATE DOMAIN. Because I'm essentially just storing
a text string with different operators, can I derive a type from
TEXT (perhaps by reusing the same input, output, receive and send
functions as TEXT?) I saw the textsend and textreceive functions,
which I assume are the appropriate functions for send and receive?
Are there any for input and output which I may reuse?

Many thanks,
Roger

--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Filip Rembiałkowski 2009-01-21 11:23:05 Re: Slow update
Previous Message Andreas Wenk 2009-01-21 10:43:13 Re: pg_restore: [archiver] entry ID -825110830 out of range -- perhaps a corrupt TOC