From: Mathieu Arnold <mat@mat.cc>
To: Raphael Bauduin <raphael@be.easynet.net>
To: pgsql-admin@postgresql.org
Subject: Re: CREATE TABLE AS ...
Date: Thu, 25 Jul 2002 18:55:41 +0200
Message-ID: <30470183.1027623340@andromede.reaumur.absolight.net> (raw)
In-Reply-To: <20020723134807.GB22069@raphael>
References: <20020723134807.GB22069@raphael>
--On mardi 23 juillet 2002 15:48 +0200 Raphael Bauduin
<raphael@be.easynet.net> wrote:
> Hi,
>
> In a data model change, I wanted to use the "create table as select"
> feature. However, I want that table to have a primary key defined, and
> thus a field defined as NOT NULL. I didn't find a way to add a NOT NULL
> constraint on a column of an existing table. If there isn't, what's the
> best way to go? A COPY?
why not just :
create table new_table (new fields with all you need);
insert into new_table <the same select as you had in your create as>;
--
Mathieu Arnold
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-admin@postgresql.org
Cc: mat@mat.cc, raphael@be.easynet.net
Subject: Re: CREATE TABLE AS ...
In-Reply-To: <30470183.1027623340@andromede.reaumur.absolight.net>
References: <20020723134807.GB22069@raphael> <30470183.1027623340@andromede.reaumur.absolight.net>
* 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