pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
serial data type
2+ messages / 2 participants
[nested] [flat]

* serial data type
@ 2001-10-27 01:44  postgresql <pgsql@symcom.com>
  0 siblings, 1 reply; 2+ messages in thread

From: postgresql @ 2001-10-27 01:44 UTC (permalink / raw)
  To: pgsql-sql


CREATE TABLE tablename (colname SERIAL);

okay, but how do I set the beginning number. So far the only thing I 
have been able to do is directly after creating the serial column, I do:

select setval('tablename_colname_seq', 15753);

Is this the only way to set the beginning number of a sequence? 

Thanks for all your help guys,

Ted Petrosky
tedpet@symcom.com





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: serial data type
@ 2001-10-28 01:23  David Stanaway <david@netventures.com.au>
  parent: postgresql <pgsql@symcom.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David Stanaway @ 2001-10-28 01:23 UTC (permalink / raw)
  To: pgsql-sql; postgresql <pgsql@symcom.com>


On Saturday, October 27, 2001, at 11:44  AM, postgresql wrote:

>
> CREATE TABLE tablename (colname SERIAL);
>
> okay, but how do I set the beginning number. So far the only thing I
> have been able to do is directly after creating the serial column, I do:
>
> select setval('tablename_colname_seq', 15753);
>
> Is this the only way to set the beginning number of a sequence?

Try looking at the output of
pg_dump -s on this database.

You will see that the SERIAL type does not appear (Since this would 
create a new sequence with an incorrect start value if the database was 
restored from the dump).

You will also see how to create a sequence with different start values 
and intervals.

==============================
David Stanaway
Personal: david@stanaway.net
Work: david@netventures.com.au




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-10-28 01:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-27 01:44 serial data type postgresql <pgsql@symcom.com>
2001-10-28 01:23 ` David Stanaway <david@netventures.com.au>

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