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.