Re: Primary key

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: rod(at)iol(dot)ie
Cc: Allan Kamau <kamauallan(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Primary key
Date: 2011-03-14 16:28:15
Message-ID: 1300120095.22696.6.camel@jd-desktop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2011-03-14 at 16:03 +0000, Raymond O'Donnell wrote:
> On 14/03/2011 15:56, Raymond O'Donnell wrote:
> > On 14/03/2011 15:35, Allan Kamau wrote:
> >
> >> CREATE SEQUENCE hy3_pack_seq MINVALUE 1000;
> >> CREATE TABLE hy3_pack
> >> (
> >> hy3_id INTEGER NOT NULL DEFAULT nextval('hy3_pack_seq') -- or hy3_id
> >> BIGINT NOT NULL DEFAULT nextval('hy3_pack_seq')
> >
> > That's what SERIAL does for you, in one go - it's just syntactic sugar
> > for the above.
>
> ....with the exception of the MINVALUE bit, of course... :-)

You can update the dependent sequence that serial creates though.

JD

>
> Ray.
>
> --
> Raymond O'Donnell :: Galway :: Ireland
> rod(at)iol(dot)ie
>

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2011-03-14 16:29:01 Re: Autocommit off - commits/rollbacks
Previous Message Alexander Pyhalov 2011-03-14 16:27:46 Re: Autocommit off - commits/rollbacks