Re: CREATE TYPE

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: CREATE TYPE
Дата
Msg-id m3k79dmert.fsf@chvatal.cbbrowne.com
обсуждение исходный текст
Ответ на CREATE TYPE  (ivan <iv@psycho.pl>)
Список pgsql-hackers
A long time ago, in a galaxy far, far away, iv@psycho.pl (ivan) wrote:
> Can you add LIKE <parent table> TO CREATE TYPE too ?  There could be
> also CREATE TYPE ble AS ( LIKE <parent_table|other_type) ); and
> CREATE TABLE ble ( LIKE <some_type> ) , and each colmnu from compose
> type will be add to table "ble" with static (NOT) NULL, and without
> defaults.
>
> what do you think ?

That seems quite INAPPROPRIATE.

In PostgreSQL, TYPEs and DOMAINs are very nearly the same thing, and a
a table is most certainly NOT a "domain."

The thing that is analagous to what you are asking about is the notion
of table inheritance, where you might have one table inherit the
fields from another.

If you want to be able to have things like NOT NULL constraints get
inherited, you would have to associate them with a DOMAIN, use the
domain to define a table, and then INHERIT from that table.

But unless you're planning to implement a fullscale "TYPE" where you
implement the various operators for storing, printing, comparing,
aggregating, and such, this just doesn't fit with what a domain/type
is about.

In the past, there has been considerable controversy as to the merits
of table inheritance in that it is NOT evident how this should work,
in theory, based on any "theory of objects."  (The last time the fight
came up, it kind of ground to a sullen halt when no one could really
agree...)
-- 
output = ("aa454" "@" "freenet.carleton.ca")
http://cbbrowne.com/info/postgresql.html
Shin: A device for finding furniture in the dark. 


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

Предыдущее
От: Lamar Owen
Дата:
Сообщение: Re: more fun with 7.3.4 RPMs
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Stuff that doesn't work yet in IPv6 patch