Re: cannot get CREATE TABLE AS to work

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Creager, Robert S" <CreagRS(at)LOUISVILLE(dot)STORTEK(dot)COM>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: cannot get CREATE TABLE AS to work
Date: 2001-03-09 16:56:35
Message-ID: web-22765@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Robert,

> How then can I add in a DEFAULT nextval in place of SERIAL and get
> the
> REFERENCES in there? Or can I?

You can't (as far as I know). If that's important to you, you need to
create the table first with a regular CREATE TABLE statement, then do
INSERT INTO. CREATE TABLE AS is, I believe, primarily for temporary
tables.

It's also a good idea to stay away from CREATE TABLE AS in applications
that might have to be portable; this is one statment whose syntax varies
widely from platform to platform. For example, Transact-SQL (MS) uses
SELECT ... INTO instead of CREATE TABLE AS.

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-03-09 17:09:57 Re: cannot get CREATE TABLE AS to work
Previous Message Peter Eisentraut 2001-03-09 16:52:30 Re: cannot get CREATE TABLE AS to work