Problem identifying constraints which should not be inherited

Lists: pgsql-bugspgsql-hackers
From: "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Problem identifying constraints which should not be inherited
Date: 2007-04-12 19:17:02
Message-ID: D45F1ECA30B59A4F96208F86532F901F14448935@rdu-caex-01.channeladvisor.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

There's no way in the pg_ tables to identify when a check constraint on
an inherited table should not be inherited. Example:

create table t1 (col1 number(10));

create table t2 () inherits t2;

alter table only t1 add constraint ck_col1 check (number <> 0);

Now, run pg_dump and notice that the check constraint is not created
with ONLY in the dump and, therefore, ends up on t2 when executed.

Chris Fischer
Database Engineer

<http://www.channeladvisor.com/>

ChannelAdvisor Corporation
2701 Aerial Center Parkway
Morrisville | North Carolina | 27560
919.228.2011

Many Channels. One Advisor.
www.channeladvisor.com <http://www.channeladvisor.com/>

<http://feeds.feedburner.com/ChanneladvisorBlog>



From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2007-04-12 20:11:41
Message-ID: 4698.1176408701@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

"Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com> writes:
> alter table only t1 add constraint ck_col1 check (number <> 0);

The bug here is that we allow that. Continuing your example,

regression=# insert into t2 values(0);
INSERT 0 1
regression=# select * from t1;
col1
------
0
(1 row)

which sure looks to me like a violation of the principle of least
surprise.

This has come up before and I think the consensus was to disallow
non-inherited check constraints; not sure why it hasn't been done yet.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chris Fischer <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-07 01:07:07
Message-ID: 200803070107.m27177O15696@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers


Added to TODO:

> o Require all CHECK constraints to be inherited
>
> http://archives.postgresql.org/pgsql-bugs/2007-04/msg00026.php

---------------------------------------------------------------------------

Tom Lane wrote:
> "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com> writes:
> > alter table only t1 add constraint ck_col1 check (number <> 0);
>
> The bug here is that we allow that. Continuing your example,
>
> regression=# insert into t2 values(0);
> INSERT 0 1
> regression=# select * from t1;
> col1
> ------
> 0
> (1 row)
>
> which sure looks to me like a violation of the principle of least
> surprise.
>
> This has come up before and I think the consensus was to disallow
> non-inherited check constraints; not sure why it hasn't been done yet.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-19 07:51:48
Message-ID: d3c4af540803190051u6b0532b4u31104838116f5a47@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

Hi,

On Fri, Mar 7, 2008 at 6:37 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

>
> Added to TODO:
>
> > o Require all CHECK constraints to be inherited
> >
> > http://archives.postgresql.org/pgsql-bugs/2007-04/msg00026.php
>
>
PFA, a small patch attached which should fix this. I have made relevant
changes in the relevant regression files too.

I was wondering though if there are other locations where we might need to
add checks to ensure that ALTER TABLE ONLY parentrel operations are ok? I
did see checks for this in some other operations like ADD COLUMN already in
place too.

Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
add_constraint_inheritance_bug.patch text/x-patch 5.8 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: NikhilS <nikkhils(at)gmail(dot)com>
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-19 14:53:22
Message-ID: 1430.1205938402@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

NikhilS <nikkhils(at)gmail(dot)com> writes:
> On Fri, Mar 7, 2008 at 6:37 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>> Added to TODO:
>> o Require all CHECK constraints to be inherited

> PFA, a small patch attached which should fix this.

If it's a small patch, it's wrong by definition. AFAICS there is no way
to fix this correctly that doesn't involve catalog changes. The point
of the TODO is that you have to enforce that the inherited constraint
sticks around, eg can't be dropped on a child table while it's still
present on the parent. There are implications for pg_dump too.

regards, tom lane


From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-20 06:49:49
Message-ID: d3c4af540803192349n1c022feemdc8bba68956d56b6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

Hi,

On Wed, Mar 19, 2008 at 8:23 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> NikhilS <nikkhils(at)gmail(dot)com> writes:
> > On Fri, Mar 7, 2008 at 6:37 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> >> Added to TODO:
> >> o Require all CHECK constraints to be inherited
>
> > PFA, a small patch attached which should fix this.
>
> If it's a small patch, it's wrong by definition. AFAICS there is no way
> to fix this correctly that doesn't involve catalog changes. The point
> of the TODO is that you have to enforce that the inherited constraint
> sticks around, eg can't be dropped on a child table while it's still
> present on the parent. There are implications for pg_dump too.
>

Ok, I understand. But even then this could patch could be considered even if
it does not solve the TODO completely, no? It atleast disallows ONLY ADD
CONSTRAINT on the parent.

Regards,
Nikhils

--
EnterpriseDB http://www.enterprisedb.com


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: NikhilS <nikkhils(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Chris Fischer <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-20 12:41:17
Message-ID: 20080320124117.GB6235@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

NikhilS escribió:

> On Wed, Mar 19, 2008 at 8:23 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> > If it's a small patch, it's wrong by definition. AFAICS there is no way
> > to fix this correctly that doesn't involve catalog changes. The point
> > of the TODO is that you have to enforce that the inherited constraint
> > sticks around, eg can't be dropped on a child table while it's still
> > present on the parent. There are implications for pg_dump too.
>
> Ok, I understand. But even then this could patch could be considered even if
> it does not solve the TODO completely, no? It atleast disallows ONLY ADD
> CONSTRAINT on the parent.

No, because you would then feel that the TODO item is completed and not
provide a patch for the whole problem :-)

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-20 13:25:43
Message-ID: d3c4af540803200625s6904e31fw4275aa73770cb417@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

Hi,

On Thu, Mar 20, 2008 at 6:11 PM, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
wrote:

> NikhilS escribió:
>
> > On Wed, Mar 19, 2008 at 8:23 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> > > If it's a small patch, it's wrong by definition. AFAICS there is no
> way
> > > to fix this correctly that doesn't involve catalog changes. The point
> > > of the TODO is that you have to enforce that the inherited constraint
> > > sticks around, eg can't be dropped on a child table while it's still
> > > present on the parent. There are implications for pg_dump too.
> >
> > Ok, I understand. But even then this could patch could be considered
> even if
> > it does not solve the TODO completely, no? It atleast disallows ONLY ADD
> > CONSTRAINT on the parent.
>
> No, because you would then feel that the TODO item is completed and not
> provide a patch for the whole problem :-)
>

:)
Guess, I should have been wordier in my earlier response and should have
mentioned:
"This patch, if acceptable can be considered as a small step towards the
TODO"
too.

Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: NikhilS <nikkhils(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Chris Fischer <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-20 14:06:06
Message-ID: 7407.1206021966@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> NikhilS escribi:
>> Ok, I understand. But even then this could patch could be considered even if
>> it does not solve the TODO completely, no? It atleast disallows ONLY ADD
>> CONSTRAINT on the parent.

> No, because you would then feel that the TODO item is completed and not
> provide a patch for the whole problem :-)

More to the point, it takes a capability away from the user without
actually solving the problem we need to solve, namely to guarantee
consistency between parent and child constraints. You can be sure
that there is someone out there who will complain that we've broken
his application when we disallow this, and we need to be able to
point to some positive benefit we got from it.

regards, tom lane


From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-27 11:14:19
Message-ID: d3c4af540803270414i49dc8981t63acdc6d02f99898@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

Hi,

On Thu, Mar 20, 2008 at 7:36 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

>
> More to the point, it takes a capability away from the user without
> actually solving the problem we need to solve, namely to guarantee
> consistency between parent and child constraints. You can be sure
> that there is someone out there who will complain that we've broken
> his application when we disallow this, and we need to be able to
> point to some positive benefit we got from it.
>

Agreed. So I think we need to implement the whole enchilada or nothing at
all. We need to do the following for this:

* Add logic to disallow ADD CONSTRAINT ONLY to parent of an inheritance
hierarchy

* Add logic to mark inherited constraints in the children:
This can be achieved by introducing a new bool "coninherited" attribute in
pg_constraint. This will be set to true on only those check constraints that
are added to children via the inheritance mechanism

* Add logic to disallow dropping inherited constraints directly on children
Obviously they will get dropped if a DROP CONSTRAINT is fired on the parent.
with recurse set to true (this is the default behaviour)

* Modify the pg_dump logic to use the new pg_constraint based attribute
logic for version 80300 (or should it be PG_VERSION_NUM 80400?) onwards.
Infact the current logic to determine if a check constraint is inherited is
to compare its name with the parent constraint name and the comment already
mentions that we should make changes in pg_constraint to avoid this
rudimentary way of determing the inheritance :).

Am important decision here is about adding a new attribute to pg_constraint
as it is the only sane way of determining inherited constraints, but that
will require an initdb. Comments?

Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com


From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "NikhilS" <nikkhils(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, <pgsql-bugs(at)postgresql(dot)org>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-27 11:52:26
Message-ID: 47EB8A7A.9010208@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

NikhilS wrote:
> Am important decision here is about adding a new attribute to pg_constraint
> as it is the only sane way of determining inherited constraints, but that
> will require an initdb. Comments?

There's no problem forcing an initdb at this point in the release cycle.
We will do that for sure many times before we reach beta stage.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: NikhilS <nikkhils(at)gmail(dot)com>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-27 15:24:29
Message-ID: 9795.1206631469@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

NikhilS <nikkhils(at)gmail(dot)com> writes:
> ...
> * Add logic to mark inherited constraints in the children:
> This can be achieved by introducing a new bool "coninherited" attribute in
> pg_constraint. This will be set to true on only those check constraints that
> are added to children via the inheritance mechanism

It probably needs to be a count not a bool. You can/should use the
handling of inherited attributes as a pattern to follow --- look at
attislocal and attinhcount.

regards, tom lane


From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Alex Hunsaker" <badalex(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-28 10:07:18
Message-ID: d3c4af540803280307n37f6536fn28892dae1bf7accc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

Hi Alex,

On Fri, Mar 28, 2008 at 4:58 AM, Alex Hunsaker <badalex(at)gmail(dot)com> wrote:

> On Thu, Mar 27, 2008 at 5:14 AM, NikhilS <nikkhils(at)gmail(dot)com> wrote:
> > * Add logic to disallow ADD CONSTRAINT ONLY to parent of an inheritance
> > hierarchy
> >
> > * Add logic to mark inherited constraints in the children:
> > This can be achieved by introducing a new bool "coninherited" attribute
> in
> > pg_constraint. This will be set to true on only those check constraints
> that
> > are added to children via the inheritance mechanism
> >
> > * Add logic to disallow dropping inherited constraints directly on
> children
> > Obviously they will get dropped if a DROP CONSTRAINT is fired on the
> parent.
> > with recurse set to true (this is the default behaviour)
> >
> > * Modify the pg_dump logic to use the new pg_constraint based attribute
> > logic for version 80300 (or should it be PG_VERSION_NUM 80400?) onwards.
> > Infact the current logic to determine if a check constraint is inherited
> is
> > to compare its name with the parent constraint name and the comment
> already
> > mentions that we should make changes in pg_constraint to avoid this
> > rudimentary way of determing the inheritance :).
> >
> >
> Attached is a WIP patch I have been playing with in my spare time. It
> should take care of the first 2. It does nothing for pg_dump or set
> (not) null/set default.
>
> Note it has some gross points (see comment in
> src/backend/catalog/heap.c AddRelationRawConstraints) and the
> regression tests I added are not quite up to par (and probably a bit
> redundant). But in the interest of saving work I thought i would post
> it.
>
>
I took a quick look and it seems to be on the lines of attislocal and
attinhcount which is a good thing. I am not sure about your syscache related
changes though and also about using enums for pg_constraint attributes which
deviates from other catalog specifications. Its good that you posted your
WIP here immediately or it would have caused duplication of efforts from my
side :)

I will take a look at the pg_dump related changes if you want. We will need
changes in flagInhAttrs() and in getTableAttrs() to query the backend for
these 2 attributes for post 80300 versions.

P.S Alvaro, I think this patch did not reach the mailing list and was
stalled due to size restrictions or something.

Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: NikhilS <nikkhils(at)gmail(dot)com>
Cc: Alex Hunsaker <badalex(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Chris Fischer <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-28 12:00:15
Message-ID: 20080328120015.GA7464@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

NikhilS escribió:

> P.S Alvaro, I think this patch did not reach the mailing list and was
> stalled due to size restrictions or something.

Argh, you are right. We don't have this on the archives anywhere :-(
Probably it got stuck on Maia ...

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: NikhilS <nikkhils(at)gmail(dot)com>
Cc: Alex Hunsaker <badalex(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Chris Fischer <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-28 12:21:36
Message-ID: 20080328122136.GC7464@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

NikhilS escribió:

> P.S Alvaro, I think this patch did not reach the mailing list and was
> stalled due to size restrictions or something.

OK, it's archived now:
http://archives.postgresql.org/pgsql-patches/2008-03/msg00392.php
Thanks.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: "Alex Hunsaker" <badalex(at)gmail(dot)com>
To: NikhilS <nikkhils(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-03-28 15:09:44
Message-ID: 34d269d40803280809y897370ds2299e722340d914c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

On Fri, Mar 28, 2008 at 4:07 AM, NikhilS <nikkhils(at)gmail(dot)com> wrote:
> Hi Alex,
>
>
> On Fri, Mar 28, 2008 at 4:58 AM, Alex Hunsaker <badalex(at)gmail(dot)com> wrote:
> > Attached is a WIP patch I have been playing with in my spare time. It
> > should take care of the first 2. It does nothing for pg_dump or set
> > (not) null/set default.
> >

Note that should say first 3 items...

>
> I took a quick look and it seems to be on the lines of attislocal and
> attinhcount which is a good thing. I am not sure about your syscache related
> changes though and also about using enums for pg_constraint attributes which
> deviates from other catalog specifications. Its good that you posted your
> WIP here immediately or it would have caused duplication of efforts from my
> side :)
>

Yeah I was planning on taking the enums out. Or at least the one i
did in pg_constraint.h.... Like I said it was a WIP :) The syscache
stuff mainly for ease of use but can be taken out easily enough if
anyone objects. (I added unique index on conrelid, constrname and
SearchSysCache(CONSTRNAME...) for the curious who did not look at the
patch).

Ill take out the enums and see about getting a real fix for
create table (x int check constraint ...) inherits ((some table that
has an x int check constraint)

expect v2 sometime later today....

> I will take a look at the pg_dump related changes if you want. We will need
> changes in flagInhAttrs() and in getTableAttrs() to query the backend for
> these 2 attributes for post 80300 versions.
>

That would be great!

> P.S Alvaro, I think this patch did not reach the mailing list and was
> stalled due to size restrictions or something.
>
>
> Regards,
> Nikhils
> --
> EnterpriseDB http://www.enterprisedb.com


From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Cc: "Alex Hunsaker" <badalex(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Chris Fischer" <Chris(dot)Fischer(at)channeladvisor(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem identifying constraints which should not be inherited
Date: 2008-04-02 07:23:27
Message-ID: d3c4af540804020023k6f6cf6abl450b2f7268c3b781@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

Hi Alvaro

On Fri, Mar 28, 2008 at 6:05 PM, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
wrote:

> NikhilS escribió:
>
> > I will take a look at the pg_dump related changes if you want. We will
> need
> > changes in flagInhAttrs() and in getTableAttrs() to query the backend
> for
> > these 2 attributes for post 80300 versions.
>
> Oh, BTW, I have not added this patch to any Commitfest page on the wiki,
> since it has obvious things that need more work. If you do work on
> them, please post the improved patch later and add it to the
> corresponding Commitfest, as appropriate.
>

I submitted the combined latest patch to the patches list yesterday. How can
I add it to the commitfest (presumably to the May one?)? Please let me know.

Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com