From: | "Alex Hunsaker" <badalex(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | NikhilS <nikkhils(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, "Pg Patches" <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: [badalex@gmail.com: Re: [BUGS] Problem identifying constraints which should not be inherited] |
Date: | 2008-05-07 06:41:34 |
Message-ID: | 34d269d40805062341g6cd610beweb28afd63caae7b8@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
On Wed, May 7, 2008 at 12:20 AM, Alex Hunsaker <badalex(at)gmail(dot)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);
From | Date | Subject | |
---|---|---|---|
Next Message | KaiGai Kohei | 2008-05-07 09:02:15 | Re: [0/4] Proposal of SE-PostgreSQL patches |
Previous Message | Dimitri Fontaine | 2008-05-07 06:22:38 | Re: alter + preserving dependencies |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2008-05-07 07:11:16 | Re: Map forks (WIP) |
Previous Message | Alex Hunsaker | 2008-05-07 06:20:37 | Re: [badalex@gmail.com: Re: [BUGS] Problem identifying constraints which should not be inherited] |