Re: ADD/DROP constraints - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ADD/DROP constraints
Date
Msg-id 1916.1149802966@sss.pgh.pa.us
Whole thread Raw
In response to ADD/DROP constraints  (Greg Stark <gsstark@mit.edu>)
Responses Re: ADD/DROP constraints
List pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> Or maybe I should insist that a matching constraint name be present *and* that
> the source text match? That's more of a pain to code though.

Yeah, that's what I'd go with.  I believe that there are bits of the
system (probably in pg_dump) that look *only* at the constraint name
when deciding what's inherited.  (This is of course bogus, but until
someone does something about coninhcount it's going to be hard to
have a non-bogus solution.)  Allowing a name mismatch would be bad.

One other point is that you should NOT rely on consrc.  See the note
at the bottom of
http://developer.postgresql.org/docs/postgres/catalog-pg-constraint.html
(Someday we should get rid of consrc altogether.)  Unfortunately it
won't do to compare conbin either, because that will contain column
numbers that won't necessarily match.  I fear you'll have to actually
reverse-compile the conbin strings and see if you get a match.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: That EXPLAIN ANALYZE patch still needs work
Next
From: Tom Lane
Date:
Subject: Re: ADD/DROP constraints