Re: pg_dump serial UNIQUE NOT NULL PRIMARY KEY - Mailing list pgsql-general

From Michael Fuhr
Subject Re: pg_dump serial UNIQUE NOT NULL PRIMARY KEY
Date
Msg-id 20050422220454.GA94766@winnie.fuhr.org
Whole thread Raw
In response to pg_dump serial UNIQUE NOT NULL PRIMARY KEY  (Michael Hipp <Michael@Hipp.com>)
List pgsql-general
On Fri, Apr 22, 2005 at 04:44:05PM -0500, Michael Hipp wrote:
>
> Hello, I'm a fairly new user of PostgreSQL 8.0.2 and I'm creating a table
> like this:
>
> CREATE TABLE cases (
>     id serial PRIMARY KEY,
>
> Works fine, but when I pg_dump the database, what shows up in the dump is:
>
> CREATE TABLE cases (
>     id serial NOT NULL,
>
> The documentation seems to say that 'serial NOT NULL' is not at all the
> same as 'serial PRIMARY KEY':

Later in the dump file you should see something like this:

ALTER TABLE ONLY cases
    ADD CONSTRAINT cases_pkey PRIMARY KEY (id);

Presumably that's because adding the primary key constraint after
populating the table is more efficient than populating the table
with the constraint (and the associated index) in place.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-general by date:

Previous
From: David Roussel
Date:
Subject: Re: PHP and Postgresql on Windows
Next
From: Bruce Momjian
Date:
Subject: Re: libpq Unicode support?