Re: Literals in foreign key definitions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
Cc: "pgsql-general(at)postgresql(dot)org List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Literals in foreign key definitions
Date: 2010-02-04 15:00:39
Message-ID: 17420.1265295639@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> writes:
> FOREIGN KEY (base, true) REFERENCES unitclass (name, is_baseclass),
> FOREIGN KEY (derived, false) REFERENCES unitclass(name, is_baseclass)

> I can of course add a few triggers to force that constraint, but I think it would be nice if the above syntax could be made to work. Or is this already in 8.4 or 8.5 or is this a can of worms? Does the SQL spec disallow it?

Yes. FK constraints have to be columns vs. columns --- otherwise they
can't be represented in the information_schema views.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lew 2010-02-04 15:12:39 Re: Shall I apply normalization in the following case?
Previous Message Chris Barnes 2010-02-04 14:54:44 Postgres wal shipping from 8.33 to 8.42.