Re: stand-alone composite types patch (was [HACKERS] Proposal: stand-alone composite types)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: stand-alone composite types patch (was [HACKERS] Proposal: stand-alone composite types)
Date: 2002-08-08 04:55:22
Message-ID: 29792.1028782522@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Joe Conway <mail(at)joeconway(dot)com> writes:
> Items 1 and 2 from the proposal above are implemented in the attached
> patch.

Good first cut, but...

I don't like the way you did the dependencies. In a normal relation,
the type row is internally dependent on the class row. This causes the
type to automatically go away if the relation is dropped, and it also
prevents an attempt to manually drop the type directly (without dropping
the relation). For a composite type, of course we want exactly the
opposite behavior: the class row should internally depend on the type,
not vice versa.

If you did it that way then you'd not need that ugly kluge in
RemoveType. What you'd need instead is some smarts (a kluge!?) in
setting up the dependency. Currently that dependency is made in
TypeCreate which doesn't know what sort of relation it's creating
a type for. Probably the best answer is to pull that particular
dependency out of TypeCreate, and make it (in the proper direction)
in AddNewRelationType.

Also, I'm not following the point of the separation between
DefineCompositeType and DefineCompositeTypeRelation; nor do I see a need
for a CommandCounterIncrement call in there.

You have missed a number of places where this new relkind ought to
be special-cased the same way RELKIND_VIEW is --- for example
CheckAttributeNames and AddNewAttributeTuples, since a composite type
presumably shouldn't have system columns associated. I'd counsel
looking at all references to RELKIND_VIEW to see which places also need
to check for RELKIND_COMPOSITE_TYPE.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim Mikheev 2002-08-08 04:58:19 Re: PITR, checkpoint, and local relations
Previous Message Joe Conway 2002-08-08 04:26:03 stand-alone composite types patch (was [HACKERS] Proposal: stand-alone composite types)

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2002-08-08 05:06:47 Re: stand-alone composite types patch (was [HACKERS] Proposal:
Previous Message Joe Conway 2002-08-08 04:26:03 stand-alone composite types patch (was [HACKERS] Proposal: stand-alone composite types)