Re: [HACKERS] Unique constraint for inherited tables?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Constantin Teodorescu <teo(at)flex(dot)ro>
Cc: "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Unique constraint for inherited tables?
Date: 2000-01-23 10:04:37
Message-ID: 200001231004.FAA22692@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I am defining a table t1 with a NOT NULL field f1 and UNIQUE field f2.
> (it automatically defines t1_f2_key unique index)
>
> I am defining now a new table t2 that inherits t1 table and add some
> columns.
>
> The NOT NULL constraint is preserved for f1 field, the UNIQUE for f2 not
> (the index t2_f2_key) is not defined.
>
> Wouldn't be normal that the unique constraint to be inherited also in
> t2?

This is on the TODO list:

* Unique index on base column not honored on inserts from inherited
table
INSERT INTO inherit_table (unique_index_col) VALUES (dup) should fail
[inherit]

--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2000-01-23 12:38:49 RE: [HACKERS] Happy column dropping
Previous Message Bruce Momjian 2000-01-23 09:40:17 column aliases