Re: Multiple Inheritance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wouter Tijhuis <tijhuis(at)cs(dot)utwente(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Multiple Inheritance
Date: 2000-11-14 16:18:34
Message-ID: 2681.974218714@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Wouter Tijhuis <tijhuis(at)cs(dot)utwente(dot)nl> writes:
> As you can see from the output this will generate a sequence error in test2.

Well, since you have columns named "id" in *both* parent tables, it's
not possible for the child to inherit both. The implementation is to
ignore test2's id and inherit only test1's. Thus, you get an id
sequence that is unique across test1 and test, but has nothing to do
with test2's id sequence.

If you want distinct ids for both test1 and test2, name the columns
differently so that the child table can inherit both.

Or, if you think that you want a globally unique id, make a common
ancestor table that both test1 and test2 inherit id from.

Or build the serial-number behavior from spare parts --- there's nothing
magic about it, it's just "DEFAULT nextval('some-sequence')" --- so you
can have direct control of which sequence generator gets used for each
table.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-11-14 16:32:58 Re: Encoding
Previous Message Gunnar R|nning 2000-11-14 16:12:43 SAP DB to be open sourced