Обсуждение: SERIAL type isn't listed...?
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? template1=> SELECT typname FROM pg_type WHERE typrelid = 0 and typname='serial';typname --------- (0 rows) Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy Systems Administrator @ hub.org primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
> 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
Serial isn't a type. The parser transforms it to int4 plus some default and a sequence. There is a TODO item in this direction, but I think no one is quite sure how/why/whether to do it. On Thu, 3 Feb 2000, The Hermit Hacker wrote: > > 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? > > > template1=> SELECT typname FROM pg_type WHERE typrelid = 0 and typname='serial'; > typname > --------- > (0 rows) > > > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy > Systems Administrator @ hub.org > primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org > > > ************ > > -- Peter Eisentraut Sernanders vaeg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
The Hermit Hacker wrote: > > 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? On 6.5, serial is not a type, but is promoted to "int4 DEFAULT nextval ( '"sequence_name_here"' ) NOT NULL", generating the associated sequence in the process. Sevo
The Hermit Hacker wrote: > > 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? Does PgAdmin support VIEWs ? They don't really exist either. ---------------------- Hannu