From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | Peter Evens <peter(at)bandit(dot)be> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: primary key |
Date: | 2011-03-14 15:20:33 |
Message-ID: | 4D7E3241.8090503@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 14/03/2011 07:57, Peter Evens wrote:
>
> hello,
>
> i have a question about the PRIMARY KEY,
> how can we let it start from for example 1000 instead of 1?
>
> This is our program:
> CREATE TABLE hy3_pack
> (
> hy3_id serial NOT NULL,
> hy3_serie_nummer text NOT NULL,
> hy3_barcode text NOT NULL,
> hy3_type_vulling text NOT NULL,
> hy3_tarra_gewicht text,
> hy3_artikel_id numeric NOT NULL,
> hy3_refill boolean,
> vernietigd boolean,
> opmerking text,
> CONSTRAINT hy3_pack_pkey PRIMARY KEY (hy3_id)
> )
> WITH (
> OIDS=FALSE
> );
> ALTER TABLE hy3_pack OWNER TO postgres;
>
> what must i change in my program?
After the CREATE TABLE, use setval() to set the current value of the
sequence used for hy3_id.
http://www.postgresql.org/docs/9.0/static/functions-sequence.html
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie
From | Date | Subject | |
---|---|---|---|
Next Message | roopal oswal | 2011-03-14 15:25:19 | Re: |
Previous Message | Yngve N. Pettersen (Developer Opera Software ASA) | 2011-03-14 15:13:59 | Re: Select for update with offset interferes with concurrent transactions |