pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Create Table xtest (like xtype)
3+ messages / 2 participants
[nested] [flat]

* Create Table xtest (like xtype)
@ 2008-02-06 19:40  TJ O'Donnell <tjo@acm.org>
  0 siblings, 1 reply; 3+ messages in thread

From: TJ O'Donnell @ 2008-02-06 19:40 UTC (permalink / raw)
  To: pgsql-sql

I know I  can create a table using names and types from an existing
table.

Create Table xtable (a Integer, b Text);
Create Table xtest (Like xtable);
This works just fine.

I want to create a table having the same column names and types as
an existing new datatype.

Create Type xtype As (a Integer, b Text);
Create Table xtest (Like xtype);
ERROR:  "xtype" is a composite type
Is that possible some other way?

TJ O'Donnell
http://www.gnova.com



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Create Table xtest (like xtype)
@ 2008-02-06 23:21  Tom Lane <tgl@sss.pgh.pa.us>
  parent: TJ O'Donnell <tjo@acm.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2008-02-06 23:21 UTC (permalink / raw)
  To: TJ O'Donnell <tjo@acm.org>; +Cc: pgsql-sql

"TJ O'Donnell" <tjo@acm.org> writes:
> Create Type xtype As (a Integer, b Text);
> Create Table xtest (Like xtype);
> ERROR:  "xtype" is a composite type

Hmmm ... as you see, that's disallowed, but offhand it seems like it
wouldn't be very hard to allow it.  It might be as simple as relaxing
the relkind check.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Create Table xtest (like xtype)
@ 2008-02-07 00:37  TJ O'Donnell <tjo@acm.org>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: TJ O'Donnell @ 2008-02-07 00:37 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: TJ O'Donnell <tjo@acm.org>; pgsql-sql

Considering how related Created Types and
Tables are (at least conceptually)
it seems like a good idea to allow
Created Types to be used in the Like clause.
At least it would help me and make maintaining
my db easier and cleaner.

TJ O'Donnell
http://www.gnova.com/

> "TJ O'Donnell" <tjo@acm.org> writes:
>> Create Type xtype As (a Integer, b Text);
>> Create Table xtest (Like xtype);
>> ERROR:  "xtype" is a composite type
>
> Hmmm ... as you see, that's disallowed, but offhand it seems like it
> wouldn't be very hard to allow it.  It might be as simple as relaxing
> the relkind check.
>
> 			regards, tom lane
>





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2008-02-07 00:37 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-02-06 19:40 Create Table xtest (like xtype) TJ O'Donnell <tjo@acm.org>
2008-02-06 23:21 ` Tom Lane <tgl@sss.pgh.pa.us>
2008-02-07 00:37   ` TJ O'Donnell <tjo@acm.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox