Sequence - Use calculated start value? - Mailing list pgsql-general

From Aragorn
Subject Sequence - Use calculated start value?
Date
Msg-id s8Vv9.634253$Ag2.24396370@news2.calgary.shaw.ca
Whole thread Raw
Responses Re: Sequence - Use calculated start value?  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-general
I need to use a calculated start value for some sequences. eg:

CREATE SEQUENCE tblco_cntcoid_key start (SELECT (MAX(cntcoid) + 100)
FROM tblco) increment 1 maxvalue 2147483647 minvalue 1  cache 1;

when I try this I get:
   ERROR: parser: parse error at or near (

I am migrating an MS Access DB to postgresql and need to retain the
current value of the id columns (er cntcoid), but when I insert new
values I want the cntcoid to start at a number greater than the last one
in the table. When I use a normal sequence or serial type for the id,
any new records are inserted starting at id 1.

Anyone know how to do this?

Thanks

--
Ron
Syscor R&D



pgsql-general by date:

Previous
From: Johannes Lochmann
Date:
Subject: Re: [SQL] Database Design tool
Next
From: terry@greatgulfhomes.com
Date:
Subject: how to force drop a table