Re: CREATE TABLE AS ...

From: Mathieu Arnold <mat(at)mat(dot)cc>
To: Raphael Bauduin <raphael(at)be(dot)easynet(dot)net>, pgsql-admin(at)postgresql(dot)org
Subject: Re: CREATE TABLE AS ...
Date: 2002-07-25 16:55:41
Message-ID: 30470183.1027623340@andromede.reaumur.absolight.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

--On mardi 23 juillet 2002 15:48 +0200 Raphael Bauduin
<raphael(at)be(dot)easynet(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Nicolas Kowalski 2002-07-25 17:25:24 database ownership and dumps
Previous Message Chris Ruprecht 2002-07-25 16:50:30 OS File Size > 1GB