Re: SERIAL and Primary Key - Mailing list pgsql-general

From Scott Marlowe
Subject Re: SERIAL and Primary Key
Date
Msg-id dcc563d10802291729t202b5d82s8ef32950e46e3b60@mail.gmail.com
Whole thread Raw
In response to SERIAL and Primary Key  ("Mike Gould" <mgould@allcoast.net>)
List pgsql-general
On Fri, Feb 29, 2008 at 2:28 PM, Mike Gould <mgould@allcoast.net> wrote:
>
>
> CREATE TABLE "fav5"."batchnumber" (
>   "batchnumberid" SERIAL NOT NULL,
>   "processtype" SMALLINT NOT NULL,
>   "termloc" CHAR(3) NOT NULL,
>   "batchno" INTEGER NOT NULL
> ) WITHOUT OIDS;
>
> With the above table definition, is batchnumberid by default also defined as
> the primary key or do I still need to define a separate Primary Key
> constraint?

Once upon a time a serial type was assumed to be a PK (or was that
unique not null???) automagically.  However, this was considered bad
form since some uses of sequence did not need those extra settings.

Serial is JUST serial nowadays, and has been for quite some time.

pgsql-general by date:

Previous
From: brian
Date:
Subject: Re: pgsql structure export to XML
Next
From: Tom Lane
Date:
Subject: Re: Confused about CASE