"Oliver Elphick" <olly@lfix.co.uk> writes:
> It seems to work, at least for my database, so here is a patch:
> [ patch to prevent dumping of inherited constraints snipped ]
I have applied this patch to both the main CVS tree and REL6_4 branch,
along with Constantin Teodorescu's suggestion to improve the formatting
of pg_dump's CREATE TABLE commands, and some work of my own to stop
an occasional coredump in pg_dump -z.
FYI, I was able to simplify your query for fetching non-inherited
checks; it now looks like:
sprintf(query, "SELECT rcname, rcsrc from pg_relcheck " "where rcrelid = '%s'::oid " " and not exists " "
(select* from pg_relcheck as c, pg_inherits as i " " where i.inhrel = pg_relcheck.rcrelid " " and c.rcname
=pg_relcheck.rcname " " and c.rcsrc = pg_relcheck.rcsrc " " and c.rcrelid = i.inhparent) ",
tblinfo[i].oid);
regards, tom lane