Re: unique/references not honored when inheriting tables

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: bahmann(at)math(dot)tu-freiberg(dot)de, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: unique/references not honored when inheriting tables
Date: 2000-10-16 21:36:37
Message-ID: Pine.BSF.4.10.10010161430340.72144-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


AFAIK, yes. Inheriting unique constraints would be a
special case of inheriting indexes theoretically, since I'd
assume that inheriting a unique column should mean unique
through entire inheritance tree. References is similar,
we'd need to do something to inherit the triggers, and
referencing to an inheritance tree needs the unique
constraint on that entire tree.

I'm not sure what it would take to do a trigger over an
inheritance tree. I guess the other option is to create
appropriate triggers when you inherit and having alter
table add/drop constraint do the same thing).

On Mon, 16 Oct 2000, Bruce Momjian wrote:

> Is this still true in 7.1?
>
>
> > Helge Bahmann (bahmann(at)math(dot)tu-freiberg(dot)de) reports a bug with a severity of 4
> > The lower the number the more severe it is.
> >
> > Short Description
> > unique/references not honored when inheriting tables
> >
> > Long Description
> > If a table inherits fields carrying the "references" or "unique" constraint, they are not honoured but silently dropped. It is necessary to manually create the triggers/indices.
> >
> > It would be nice if it were possible to create an index across a table and all sub-tables.
> >
> >
> > Sample Code
> > CREATE TABLE foo(id int unique)
> > CREATE TABLE bar() INHERITS (foo)
> > INSERT INTO bar VALUES(1)
> > INSERT INTO bar VALUES(1)
> >
> >
> > No file was uploaded with this report
> >
> >
>
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> 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-bugs by date

  From Date Subject
Next Message Lennert Buytenhek 2000-10-16 21:55:34 Re: eeeh... buffer leak?
Previous Message Tom Lane 2000-10-16 20:06:03 Re: constraints evaluate 'now' immediately

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-10-16 22:02:52 Re: AW: new relkind for view
Previous Message Bruce Momjian 2000-10-16 21:14:32 Re: AW: new relkind for view