Using a table's data type...

Поиск
Список
Период
Сортировка
Искать

Using a table's data type...

От:
"murphy pope" <pope_murphy@hotmail.com>
Дата:
When I create a new table, I have also created a new data type (whose name 
is the same as the name of the table).  For example:

CREATE TABLE customer(
  customer_id integer,
  customer_name varchar );

creates a new data type named 'customer'.  I can now create another table 
that includes a column whose type is 'customer':

CREATE TABLE customer_archive(
  customer_info customer,
  mod_date timestamp );

Now, a couple of really basic questions.
1)  Is there a way to insert a row into this table?

2)  Since customer_archive.customer_info is defined to be a composite 
column, how would I address each member?

3)  Is this just a really dumb idea on my part?  Maybe the fact that I can 
use a table's type to define a column is just accidental and I really 
shouldn't do that.

Any opinions, answers, or documentation references are appreciated.  Thanks.

    -- Murphy

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

Re: Using a table's data type...

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"murphy pope"  writes:
> Maybe the fact that I can use a table's type to define a column is
> just accidental and I really shouldn't do that.

It did actually do something quasi-useful, I believe, back in the
PostQUEL days.  But it hasn't worked for a long time, and I don't think
there's any interest in reviving it.  Some day we should deliver the
coup de grace and get rid of 'attisset' completely.

			regards, tom lane
FAQ