pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Stanaway <david@netventures.com.au>
To: PgSQL-SQL <pgsql-sql@postgresql.org>
To: postgresql <pgsql@symcom.com>
Subject: Re: serial data type
Date: Sun, 28 Oct 2001 12:23:59 +1100
Message-ID: <76B9DDD4-CB42-11D5-B24B-0003930FDAB2@netventures.com.au> (raw)
In-Reply-To: <200110270135.f9R1ZmP66919@postgresql.org>


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




view thread (2+ messages)

Message-ID: <76B9DDD4-CB42-11D5-B24B-0003930FDAB2@netventures.com.au>
Permalink:  ../76B9DDD4-CB42-11D5-B24B-0003930FDAB2@netventures.com.au/
Also on:    postgresql.org/message-id/76B9DDD4-CB42-11D5-B24B-0003930FDAB2@netventures.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: david@netventures.com.au, pgsql@symcom.com
  Subject: Re: serial data type
  In-Reply-To: <76B9DDD4-CB42-11D5-B24B-0003930FDAB2@netventures.com.au>
  References: <200110270135.f9R1ZmP66919@postgresql.org> <76B9DDD4-CB42-11D5-B24B-0003930FDAB2@netventures.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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