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