Re: Is a SERIAL column a "black box", or not?

From: elein <elein(at)varlena(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>, Hannu Krosing <hannu(at)skype(dot)net>, mark(at)mark(dot)mielke(dot)cc, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Is a SERIAL column a "black box", or not?
Date: 2006-05-02 01:43:00
Message-ID: 20060502014300.GA5294@varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 01, 2006 at 07:47:06PM -0400, Tom Lane wrote:
> "Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> > I think a big point that's being missed here is that SERIAL *is* trying
> > to be simple. If you need something more sophisticated or complex you
> > shouldn't be using SERIAL at all, you should be doing the stuff
> > yourself, by hand.
>
> I agree with this point in the abstract, but one important proviso is
> that it has to be *possible* to do it by hand. One good thing about
> the "SERIAL is just a macro" approach is that it keeps us honest about
> making sure that SERIAL isn't exploiting any weird internal behaviors
> that are hard to duplicate for handmade sequence defaults. We've
> already broken that to some extent by having the hidden dependency,
> and that in turn means that fairly-reasonable expectations like
> "pg_get_serial_sequence should find the column's associated sequence"
> don't work on handmade sequences. I don't want to go much further in
> that direction. If there's a usability problem we're trying to solve
> for SERIALs, we should make sure the problem gets solved for handmade
> sequences too.
>
> regards, tom lane

I agree with Tom's proviso and add one of my own, mentioned earlier.
It should be easy to use a sequence w/alter sequence almost all of
the time. The majority of the crowd should be able to use SERIAL in
the majority of cases. One reason I am adamant about this is the
v. useful dependencies that are (should be) set between the table
and the sequence when it is declared as a SERIAL.

--elein

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2006-05-02 02:26:30 Re: Is a SERIAL column a "black box", or not?
Previous Message Christopher Kings-Lynne 2006-05-02 01:41:41 Re: Is a SERIAL column a "black box", or not?