Re: [PATCHES] [badalex@gmail.com: Re: [BUGS] Problem identifying constraints which should not be inherited]
От | Alex Hunsaker |
---|---|
Тема | Re: [PATCHES] [badalex@gmail.com: Re: [BUGS] Problem identifying constraints which should not be inherited] |
Дата | |
Msg-id | 34d269d40805062341g6cd610beweb28afd63caae7b8@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCHES] [badalex@gmail.com: Re: [BUGS] Problem identifying constraints which should not be inherited] (NikhilS <nikkhils@gmail.com>) |
Список | pgsql-hackers |
On Wed, May 7, 2008 at 12:20 AM, Alex Hunsaker <badalex@gmail.com> 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);
В списке pgsql-hackers по дате отправления: