On Wed, May 7, 2008 at 12:20 AM, Alex Hunsaker <[EMAIL PROTECTED]> wrote: > Find attached a diff from v4-v5, and a full patch. > > src/backend/commands/tablecmds.c | 242 > +++++++++++++++++++++++------------- > > src/backend/utils/cache/syscache.c | 12 -- > > src/include/catalog/indexing.h | 2 - > src/include/utils/syscache.h | 1 - > 4 files changed, 153 insertions(+), 104 deletions(-) > > Currently this loops through all the constraints for a relation (old > behavior of MergeAttributesIntoExisting)... Do you think its worth > adding a non-unique index to speed this up? If so I can whip up a > patch real quick if you think its worth it... else >
*sigh* Here is a fiix for a possible bogus "failed to find constraint" error when we are trying to drop a constraint that is not a check constraint (interesting no regression tests failed... caught it while reviewing the patch I just posted) *** a/src/backend/commands/tablecmds.c --- /bsrc/backend/commands/tablecmds.c *************** ATExecDropConstraint(Relation rel, const *** 5080,5094 **** con = (Form_pg_constraint) GETSTRUCT(tuple); - if (con->contype != CONSTRAINT_CHECK) - continue; - if (strcmp(NameStr(con->conname), constrName) != 0) continue; else found = true; if (con->coninhcount <= 0) elog(ERROR, "relation %u has non-inherited constraint \"%s\"", childrelid, constrName); --- 5080,5095 ---- con = (Form_pg_constraint) GETSTRUCT(tuple); if (strcmp(NameStr(con->conname), constrName) != 0) continue; else found = true; + /* Right now only CHECK constraints can be inherited */ + if (con->contype != CONSTRAINT_CHECK) + continue; + if (con->coninhcount <= 0) elog(ERROR, "relation %u has non-inherited constraint \"%s\"", childrelid, constrName); -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers