pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Range of Serial values
4+ messages / 3 participants
[nested] [flat]

* Range of Serial values
@ 2001-04-16 15:29  cbell <cbell@lighthouseasp.com>
  0 siblings, 1 reply; 4+ messages in thread

From: cbell @ 2001-04-16 15:29 UTC (permalink / raw)
  To: pgsql-sql

Hello everyone,

when creating a serial column, is there a way to specify which number it
will start counting from?  For example, if you wanted all Serial ID's to
start at 1000 and count up from there, with no numbers below that.

Thanks,
Chris.




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

* Re: Range of Serial values
@ 2001-04-16 15:42  Justin Clift <justin@postgresql.org>
  parent: Poul L. Christiansen <poulc@cs.auc.dk>
  0 siblings, 0 replies; 4+ messages in thread

From: Justin Clift @ 2001-04-16 15:42 UTC (permalink / raw)
  To: Poul L. Christiansen <poulc@cs.auc.dk>; +Cc: cbell <cbell@lighthouseasp.com>; pgsql-sql

Hi,

I believe you could also create the sequence, then update it with
setval('<sequence name>', <number>);

Regards and best wishes,

Justin Clift

"Poul L. Christiansen" wrote:
> 
> Yes, there is.
> 
> When you create a serial column a sequence is created, which does the
> counting.
> 
> You can create a serial column, drop the associated sequence and create
> a new one with the command:
> "CREATE SEQUENCE seqname START 1000".
> 
> See also "\h CREATE SEQUENCE".
> 
> HTH,
> Poul L. Christansen
> 
> cbell wrote:
> >
> > Hello everyone,
> >
> > when creating a serial column, is there a way to specify which number it
> > will start counting from?  For example, if you wanted all Serial ID's to
> > start at 1000 and count up from there, with no numbers below that.
> >
> > Thanks,
> > Chris.
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

-- 
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi



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

* Re: Range of Serial values
@ 2001-04-16 16:06  Poul L. Christiansen <poulc@cs.auc.dk>
  parent: cbell <cbell@lighthouseasp.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Poul L. Christiansen @ 2001-04-16 16:06 UTC (permalink / raw)
  To: cbell <cbell@lighthouseasp.com>; +Cc: pgsql-sql

Yes, there is.

When you create a serial column a sequence is created, which does the
counting.

You can create a serial column, drop the associated sequence and create
a new one with the command:
"CREATE SEQUENCE seqname START 1000".

See also "\h CREATE SEQUENCE".

HTH,
Poul L. Christansen

cbell wrote:
> 
> Hello everyone,
> 
> when creating a serial column, is there a way to specify which number it
> will start counting from?  For example, if you wanted all Serial ID's to
> start at 1000 and count up from there, with no numbers below that.
> 
> Thanks,
> Chris.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html



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

* Re: Range of Serial values
@ 2001-04-16 17:48  cbell <cbell@lighthouseasp.com>
  0 siblings, 0 replies; 4+ messages in thread

From: cbell @ 2001-04-16 17:48 UTC (permalink / raw)
  To: pgsql-sql

Thank you Poul and Justin, I'll give it a try!!!




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


end of thread, other threads:[~2001-04-16 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-16 15:29 Range of Serial values cbell <cbell@lighthouseasp.com>
2001-04-16 16:06 ` Poul L. Christiansen <poulc@cs.auc.dk>
2001-04-16 15:42   ` Justin Clift <justin@postgresql.org>
2001-04-16 17:48 Re: Range of Serial values cbell <cbell@lighthouseasp.com>

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