Re: [HACKERS] Sequences.... - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Sequences....
Date
Msg-id 14967.921555947@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Sequences....  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
BTW, has anyone thought twice about the interaction of SERIAL columns
with inheritance?  If I create a table having a SERIAL column and then
create a child table that inherits from the first, what happens?  Does
the child share the use of the parent's sequence (implying that serial
number assignments are unique across the parent and all its children)?
Or does the child get a new sequence object of its very own --- and if
so, what does that sequence object start out at?

We ought to find out what the current code actually does and then think
about whether we like it or not; I'll bet that the current behavior was
not designed but just fell out of the implementation.

If we do want shared use of a parent's sequence, that's going to
complicate Ryan's new system table considerably --- probably it needs
to have a row for each table using a particular sequence-created-to-
implement-SERIAL, and the sequence object can be deleted only when the
last reference to it goes away.  Life may become even more interesting
for pg_dump, too.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: [GENERAL] Bug with sequences in 6.4.2
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] HTML index of source code