Re: Custom type, operators and operator class not sorting/indexing correctly - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Custom type, operators and operator class not sorting/indexing correctly
Date
Msg-id 20090121195219.GA31050@svana.org
Whole thread Raw
In response to Re: Custom type, operators and operator class not sorting/indexing correctly  (Roger Leigh <rleigh@codelibre.net>)
Responses Re: Custom type, operators and operator class not sorting/indexing correctly  (Roger Leigh <rleigh@codelibre.net>)
List pgsql-general
On Wed, Jan 21, 2009 at 10:48:09AM +0000, Roger Leigh wrote:
> 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?

Yes, you can copy all the existing attributes. Use:

select * from pg_type where typname='text';

To get the relevent info (upcoming 8.4 will have CREATE TYPE xxx
(LIKE=text) ). Lookup the citext project for an example.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Attachment

pgsql-general by date:

Previous
From: Kirk Strauser
Date:
Subject: Followup: Here's why I want to use connection pooling middleware!
Next
From: "Brent Wood"
Date:
Subject: how to implement a foreign key type constraint against a not unique column