Using a table's data type... - Mailing list pgsql-general

From murphy pope
Subject Using a table's data type...
Date
Msg-id F172Trn1iUCT0RVn9xO0000a6ea@hotmail.com
Whole thread Raw
Responses Re: Using a table's data type...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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


pgsql-general by date:

Previous
From: "Joel Burton"
Date:
Subject: Re: Listing of Rules within psql?
Next
From: "Hiroshi Inoue"
Date:
Subject: Re: Using views and MS access via odbc