From: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | RE: Updating system catalogs after a tuple deletion |
Date: | 2001-05-21 01:43:33 |
Message-ID: | ECEHIKNFIMMECLEBJFIGKEJFCAAA.chriskl@familyhealth.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> Actually this brings up a problem I'm having with ALTER TABLE ADD
> CONSTRAINT and since it mostly affects you with DROP CONSTRAINT, I'll
> bring it up here. If you have a table that has check constraints or
> is inherited from multiple tables, what's the correct way to name an
> added constraint that's being inherited? If it's $2 in the parent,
> but the child already has a $2 defined, what should be done? The
> reason this affects drop constraint is knowing what to drop in the
> child. If you drop $2 on the parent, what constraint(s) on the child
> get dropped?
It occurs to me that there's a solution to this problem. All you need to do
is in heap.c in the piece of code I modified earlier for generating
constraint names and checking specified ones you simply make sure it is
unique for the parent table and for ALL its children.
This will stop people (1) adding named constraints that aren't unique across
all children, noting that these new constraints need to be added to the
children as well as the parent and (2) dynamically generated constraint
names will be unique across all children and also can then be immediately
propagated to inherited tables.
With this enforced, surely there is a _guaranteed_ match between the name of
a parent constraint and the same constraint in the inherited tables? The
only problem, I guess, would be when you import data from old versions of
PostgreSQL into a new version that has this assumption/restriction.
Chris
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Kings-Lynne | 2001-05-21 01:58:37 | New system catalog idea |
Previous Message | Lincoln Yeoh | 2001-05-21 01:28:06 | Re: Plans for solving the VACUUM problem |