Re: Outstanding patches

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Outstanding patches
Date: 2001-05-09 14:29:41
Message-ID: 3.0.5.32.20010510002941.02cf7920@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

At 09:36 9/05/01 -0400, Bruce Momjian wrote:
>>
>> Is anybody planning to fix the problem with ALTER TABLE ADD CONSTRAINT...
>> in which the constraints are not applied to child tables?
>
>I thought we had not figured out how to inherit those, or at least
>certain constraints like UNIQUE. We do have on TODO:
>
> * Allow inherited tables to inherit index, UNIQUE constraint, and
> primary key [inheritance]
>

aaa=# create table t1(f1 integer check(f1<>0),primary key (f1));
aaa=# create table t1c() inherits (t1);
aaa=# \d t1c
Table "t1c"
Attribute | Type | Modifier
-----------+---------+----------
f1 | integer | not null
Constraint: (f1 <> 0)

So PK is not inherited, but CHECK (and implied NOT NULL) seem to be.

Whereas,

aaa=# create table t1(f1 integer);
aaa=# create table t1c() inherits (t1);
aaa=# alter table t1 add constraint aaa check(f1<>0);
aaa=# \d t1c
Table "t1c"
Attribute | Type | Modifier
-----------+---------+----------
f1 | integer |

ie. The CHECK constraints inherit only at the time of table creation. I
think this is a bug in ALTER TABLE for CHECK constraints.

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-05-09 15:00:23 Re: Outstanding patches
Previous Message Bruce Momjian 2001-05-09 13:36:07 Re: Outstanding patches

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mark Rosa 2001-05-09 14:42:10 Re: JDBC Download.
Previous Message Dave Cramer 2001-05-09 14:23:17 Re: JDBC Download.