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.