Re: No reference to inherited columns?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Christian Marschalek <cm(at)chello(dot)at>
Cc: "[GENERAL] PostgreSQL" <pgsql-general(at)postgresql(dot)org>
Subject: Re: No reference to inherited columns?
Date: 2001-05-09 16:08:22
Message-ID: Pine.BSF.4.21.0105090903070.86660-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 9 May 2001, Christian Marschalek wrote:

> Can it be that I cannot reference to any inherited columns? Or is there
> a special way to do it? The manual doesn't seem to cover this one...

Well, if you mean reference a subtable's copy of an inherited column,
you should be able to do this as long as you create a unique index
on the subtable's copy of the inherited column (create unique index
subtable_column on subtable(column)) before you try to define the
constraint.
Example:
create table base (id int);
create table child (subvalue int) inherits (base);
create unique index child_id on child(id);
create table fk (childid int references child(id));

If you want to reference an entire tree (ie, reference a parent's
copy of a column and have it also reference children) you're
currently not able to do that.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2001-05-09 16:08:23 RE: Case sensitive order by
Previous Message Ryan C. Bonham 2001-05-09 15:54:12 MS SQL 7.0 to PostgreSQL 7.1