pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Creager, Robert S <CreagRS@LOUISVILLE.STORTEK.COM>
Cc: pgsql-sql@postgresql.org
Subject: Re: cannot get CREATE TABLE AS to work
Date: Fri, 09 Mar 2001 08:56:35 -0800
Message-ID: <web-22765@davinci.ethosmedia.com> (raw)
In-Reply-To: <10FE17AD5F7ED31188CE002048406DE8514CE0@lsv-msg06.stortek.com>

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@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



view thread (10+ messages)  latest in thread

Message-ID: <web-22765@davinci.ethosmedia.com>
Permalink:  ../web-22765@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-22765@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, CreagRS@LOUISVILLE.STORTEK.COM
  Subject: Re: cannot get CREATE TABLE AS to work
  In-Reply-To: <web-22765@davinci.ethosmedia.com>
  References: <10FE17AD5F7ED31188CE002048406DE8514CE0@lsv-msg06.stortek.com> <web-22765@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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