Re: ADD/DROP INHERITS

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-patches(at)postgresql(dot)org
Subject: Re: ADD/DROP INHERITS
Date: 2006-06-15 15:10:05
Message-ID: 87r71qa20i.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Greg Stark <gsstark(at)mit(dot)edu> writes:
> > So should I set up a nested scan, essentially implementing a nested loop? or
> > should I gather together all the children in a list?
>
> I'd use the predigested form of the constraints attached to the Relation
> tupledescs, cf. RelationBuildTupleDesc, equalTupleDescs.

I've spent more time absorbing relcache.c and I see now that there is in fact
a ccname array that contains the constraint names.

The relcache does not however contain the deferrable and isdeferred flags
which as you point out don't mean much for check constraints. But you said I
should be checking those. Going with the relcache would mean not being able to
check them.

Going with the relcache would also mean I wouldn't be able to easily add
foreign key constraints. I had hoped to add foreign key constraints to the
list of things that inherited tables copy and checking for them in
AddInherits.

So I'm thinking it's better to leave my implementation as is rather than
reimplement it using the relcache. Or would it be better to use the relcache
and then when and if it comes to making inherited tables inherit foreign key
constraints look into adding foreign keys and the deferrable and isdeffered
flags to the relcache?

> It might be worth refactoring equalTupleDescs so you could share code ---
> ISTM what you're trying to implement is something like a "subsetTupleDesc".

I still don't see how there's any refactoring possible here. I could move the
code into a function in tupdesc.c but then it would mean an entirely redundant
loop to bump attinhcount.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-06-15 15:19:04 Re: ADD/DROP INHERITS
Previous Message Greg Stark 2006-06-15 15:01:53 CREATE TABLE LIKE INCLUDING CONSTRAINTS

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-06-15 15:19:04 Re: ADD/DROP INHERITS
Previous Message Tom Lane 2006-06-15 14:27:33 Re: Test request for Stats collector performance improvement