Re: [HACKERS] SERIAL type isn't listed...? - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] SERIAL type isn't listed...?
Date
Msg-id 3899AD73.1C31C1A6@alumni.caltech.edu
Whole thread Raw
In response to SERIAL type isn't listed...?  (The Hermit Hacker <scrappy@hub.org>)
List pgsql-hackers
> Shouldn't this produce something?  Was talking with Dave Page today about
> the lack of a serial type in PgAdmin, and he mentioned that its not a 
> listed type?

Right. That's because the SERIAL type is a parser kludge rather than a
full-fledged type. At the moment, a column defined as SERIAL becomes,
in the parser backend, a defined sequence (CREATE SEQUENCE ...) and an
INT4 column with a constraint of DEFAULT ... which refers to the
sequence just created.

There are downsides to this: the implicit SEQUENCE is not cleaned up
if the column is destroyed; explicit reference to SERIAL is lost
during dump/restore; the implicit stuff just leads to confusion, etc
etc etc.

Perhaps eventually it should become a type on its own, directly
accessing the same structures as Vadim's "sequence" code. Or perhaps
it could be done using the SPI interface.
                  - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: SERIAL type isn't listed...?
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: [SQL] Proposed Changes to PostgreSQL