Using a table's data type...

From: "murphy pope" <pope_murphy(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Using a table's data type...
Date: 2002-05-05 19:59:52
Message-ID: F172Trn1iUCT0RVn9xO0000a6ea@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hiroshi Inoue 2002-05-05 23:15:09 Re: Using views and MS access via odbc
Previous Message Joel Burton 2002-05-05 15:21:37 Re: Listing of Rules within psql?