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

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Custom type, operators and operator class not sorting/indexing correctly
Дата
Msg-id 20090121195219.GA31050@svana.org
обсуждение исходный текст
Ответ на Re: Custom type, operators and operator class not sorting/indexing correctly  (Roger Leigh <rleigh@codelibre.net>)
Ответы Re: Custom type, operators and operator class not sorting/indexing correctly
Список 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.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Kirk Strauser
Дата:
Сообщение: Followup: Here's why I want to use connection pooling middleware!
Следующее
От: "Brent Wood"
Дата:
Сообщение: how to implement a foreign key type constraint against a not unique column