Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Patches > Re: [badalex@gm...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3693 of 3916
Post > Topic >>

Re: [badalex@gmail.com: Re: [BUGS] Problem identifying constraints which should not be inherited]

by badalex@[EMAIL PROTECTED] ("Alex Hunsaker") May 7, 2008 at 12:41 AM

On Wed, May 7, 2008 at 12:20 AM, Alex Hunsaker <badalex@[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-patches mailing list (pgsql-patches@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
 




 1 Posts in Topic:
Re: [badalex@gmail.com: Re: [BUGS] Problem identifying constrain
badalex@[EMAIL PROTECTED]  2008-05-07 00:41:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 5:09:44 CDT 2008.