Re: Bug and/or feature? Complex data types in tables...

Поиск
Список
Период
Сортировка
От Chris Travers
Тема Re: Bug and/or feature? Complex data types in tables...
Дата
Msg-id 008f01c3d1b9$4f947470$1800053d@winxp
обсуждение исходный текст
Ответ на Bug and/or feature? Complex data types in tables...  ("Chris Travers" <chris@travelamericas.com>)
Ответы Re: Bug and/or feature? Complex data types in tables...  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Bug and/or feature? Complex data types in tables...  (Michael Glaesemann <grzm@myrealbox.com>)
Re: Bug and/or feature? Complex data types in tables...  (Michael Glaesemann <grzm@myrealbox.com>)
Список pgsql-general
> (To avoid confusion since we're talking about complex numbers, I'm
> assuming you mean what PostgreSQL refers to as composite types.) It
> definitely would be nice to be able to define composite types that can
> be used as attributes and functions. It seems like there's quite a bit
> of, er, functionality with composite types already. I don't have
> pl/pgsql installed, but I was able to create some simple operators with
> just SQL (see below). They're not perfect (and don't let us use
> composite types in tables); just exploring what I could do. I wonder
> what it would take to allow these user-defined types defined in
> PostgreSQL (rather than C) usable in tables.


AFAICS, there are only one thing missing and it could probably be worked
around if the backend did nto crash when you try to retrieve the information
via a casting function.  It is:

Some way to define a standard input and output representation (how it is
done in C).

If you can define your own casts, you can then select complex::text from
mytable (but this would crash the backend again :-( )

Of course for complex numbers, you might be able use a domain off of points,
and then define special operators for them (for example, adding complex
numbers is meaningful, but adding points is not).  But this might not work
for other sorts of types.

Best Wishes,
Chris Travers


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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: Bug and/or feature? Complex data types in tables...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug and/or feature? Complex data types in tables...