Re: [HACKERS] sequence creation\

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: maillist(at)candle(dot)pha(dot)pa(dot)us (Bruce Momjian), hackers(at)postgreSQL(dot)org (PostgreSQL-development)
Subject: Re: [HACKERS] sequence creation\
Date: 1998-08-19 03:12:18
Message-ID: m0z8yfa-00006FC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thus spake Thomas G. Lockhart
> > Perhaps use the data type SERIAL to autocreate a sequence. Should
> > make life easier for novices. We are getting too many sequence
> > questions.
>
> That would be possible. I'd be happier doing it for v6.5, since I'm
> hoping to work on docs in the meantime. Of course, maybe it would be
> easy :)
>
> What should the syntax be exactly?
>
> CREATE TABLE t (s SERIAL);
>
> or
>
> CREATE TABLE t (i INT DEFAULT SERIAL);

I think the first one is simpler and, as far as I know, is more common
in existing practice.

> Are there alternate syntaxes from other DBs which should be considered?

The standard doesn't specify a serial type. One question would be,
what is the behaviour? Should the field always be set to the next
number on insert or should we be able to override it? I prefer the
former but I can see that it would be a problem on dump and reload.
How do other DBs handle this?

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-08-19 03:17:02 system caches
Previous Message Thomas G. Lockhart 1998-08-19 02:35:41 Re: [HACKERS] sequence creation