pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcustomising serial type
4+ messages / 4 participants
[nested] [flat]
* customising serial type
@ 2005-06-21 10:01 Kenneth Gonsalves <lawgon@thenilgiris.com>
0 siblings, 3 replies; 4+ messages in thread
From: Kenneth Gonsalves @ 2005-06-21 10:01 UTC (permalink / raw)
To: pgsql-sql
hi,
in a table with a serial datatype, how do i get the sequence to start
at a specific number like 100000?
--
regards
kg
http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: customising serial type
@ 2005-06-21 10:07 Krasimir Dimitrov <kr@aiidatapro.com>
parent: Kenneth Gonsalves <lawgon@thenilgiris.com>
2 siblings, 0 replies; 4+ messages in thread
From: Krasimir Dimitrov @ 2005-06-21 10:07 UTC (permalink / raw)
To: Kenneth Gonsalves <lawgon@thenilgiris.com>; +Cc: pgsql-sql
On Tuesday 21 June 2005 13:01, you wrote:
> hi,
> in a table with a serial datatype, how do i get the sequence to start
> at a specific number like 100000?
ALTER SEQUENCE sequence_name RESTART WITH 100000;
--
________________________________________________________
Krasimir Dimitrov
IT Department
AII Data Processing Ltd.,
16 Ivan Vazov Str,
Sofia 1000,
Bulgaria
Phone: +359 2 9376 352
E-mail: kr@aiidatapro.com
http://www.see-news.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: customising serial type
@ 2005-06-21 10:23 Michael Glaesemann <grzm@myrealbox.com>
parent: Kenneth Gonsalves <lawgon@thenilgiris.com>
2 siblings, 0 replies; 4+ messages in thread
From: Michael Glaesemann @ 2005-06-21 10:23 UTC (permalink / raw)
To: Kenneth Gonsalves <lawgon@thenilgiris.com>; +Cc: pgsql-sql
On Jun 21, 2005, at 7:01 PM, Kenneth Gonsalves wrote:
> in a table with a serial datatype, how do i get the sequence to start
> at a specific number like 100000?
The SERIAL datatype (e.g., CREATE TABLE foo(foo_id SERIAL) )is a
shorthand for something like
CREATE SEQUENCE foo_id_seq;
CREATE TABLE foo (foo_id integer default nextval('foo_id_seq') );
If you want it to specify the start value, you'll need to either use
CREATE SEQUENCE first and then create the table with the appropriate
default, or use ALTER SEQUENCE after creating the table.
http://www.postgresql.org/docs/8.0/interactive/sql-createsequence.html
http://www.postgresql.org/docs/8.0/interactive/sql-altersequence.html
Michael Glaesemann
grzm myrealbox com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: customising serial type
@ 2005-06-21 16:34 Stefan Becker <stefan@yukonho.de>
parent: Kenneth Gonsalves <lawgon@thenilgiris.com>
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Becker @ 2005-06-21 16:34 UTC (permalink / raw)
To: pgsql-sql
Am Dienstag, 21. Juni 2005 12:01 schrieben Sie:
> hi,in a table with a serial datatype, how do i get the sequence to start at
> a specific number like 100000?
Use START in the create sequence statement.
#
create sequence seq_xeingang increment 1 start 1000;
;
CREATE TABLE xeingang
(
id integer default nextval('seq_xeingang'),
buch char not null,
eingdt date not null,
jnr integer not null,
grp integer,
code integer not null
);
my best regards..
Stefan
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2005-06-21 16:34 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-21 10:01 customising serial type Kenneth Gonsalves <lawgon@thenilgiris.com>
2005-06-21 10:07 ` Krasimir Dimitrov <kr@aiidatapro.com>
2005-06-21 10:23 ` Michael Glaesemann <grzm@myrealbox.com>
2005-06-21 16:34 ` Stefan Becker <stefan@yukonho.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox