Re: [HACKERS] Sequences....

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: Ryan Bradetich <rbrad(at)hpb50023(dot)boi(dot)hp(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Sequences....
Date: 1999-03-16 04:22:01
Message-ID: 36EDDC69.A103C33@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ryan Bradetich wrote:
> >
> > Take the following example:
> > CREATE TABLE foo (i SERIAL, t text);
> >
> > This creates table foo, index foo_i_key, and the sequence foo_i_seq.
> >
> > The sequence ocuppies three of the system tables: pg_class, pg_attribute, and
> > pg_attrdef. When the table gets dropped, the table foo and foo_i_key are
> > removed. The default portion of the sequence is also removed from the
> > pg_attrdef system table, because the attrelid matches the table's oid.
> >
> > I believe this is incorrect ... I think the attrelid should match the seqences
> > oid instead of the table's oid to prevent the following error:

pg_attrdef->attrelid is used to store DEFAULT definition
for particular attribute -> DEFAULT part of SERIAL definition
will not work after this...

> >
> > Back to my origional point .. I think we need another system table to map the
> > sequence oid to the table's oid. I've noticed this done with the inheritance,
> > indexes, etc ... but I don't see a pg_sequence table.

Sequences and tables are independent things - that's why
there was no pg_sequence table. Currently each sequence
has row in pg_class, i.e. sequences are special tables.
But I agreed that we need in new table to reflect
SERIAL <--> sequence dependencies.

Vadim

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-03-16 04:32:18 Re: [HACKERS] Re: [GENERAL] Bug with sequences in 6.4.2
Previous Message Bruce Momjian 1999-03-16 04:09:21 Re: Developers Globe (FINAL)