Re: [HACKERS] SERIAL type isn't listed...?

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: The Hermit Hacker <scrappy(at)hub(dot)org>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] SERIAL type isn't listed...?
Date: 2000-02-03 16:31:47
Message-ID: 3899AD73.1C31C1A6@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2000-02-03 16:43:51 Parser/planner and column aliases
Previous Message Karel Zak - Zakkr 2000-02-03 16:31:04 array operators to the main tree