Re: Reducing some DDL Locks to ShareLock

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reducing some DDL Locks to ShareLock
Date: 2008-10-07 15:12:28
Message-ID: 1223392348.4747.219.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Tue, 2008-10-07 at 10:35 -0400, Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> > On Tue, 2008-10-07 at 10:05 -0400, Robert Haas wrote:
> >>> 3. The patch introduces a slight weirdness: if you create two FKs on the
> >>> same column at the same time you end up with two constraints with
> >>> identical names. Drop constraint then removes them both, though in other
> >>> respects they are both valid, just not uniquely. CREATE INDEX avoids
> >>> this by way of the unique index on relname. The equivalent index on
> >>> pg_constraint is not unique, though *cannot* be made unique without
> >>> breaking some corner cases of table inheritance.
> >>
> >> Urk... this seems pretty undesirable.
>
> > OK, but please say what behaviour you would like in its place.
>
> I wonder whether this could be helped if we refactored pg_constraint.
> The lack of a useful pkey for it has been annoying me for awhile,
> and I think it stems from a misguided choice to put table and domain
> constraints into the same catalog. Suppose that
>
> * table constraints go into pg_relation_constraint, with a unique key
> on (conrelid, conname)
>
> * domain constraints go into pg_domain_constraint, with a unique key
> on (contypid, conname)
>
> * pg_constraint can still exist as a union view, for client
> compatibility
>
> Then the unique key would prevent concurrent creation of
> identically-named constraints for the same relation.

Sounds better. Doesn't make much sense as it is now.

> I'm confused by your comment about inheritance --- what cases are
> you thinking this would break?

Well, I made the index unique and got a boat load of errors. I guess I
might have misdiagnosed their cause. I'll have another look.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-10-07 15:15:44 Re: Reducing some DDL Locks to ShareLock
Previous Message Simon Riggs 2008-10-07 15:08:58 Re: [PATCHES] Infrastructure changes for recovery