Re: [GENERAL] Literals in foreign key definitions

2010-02-05 Thread Alban Hertroys
On 4 Feb 2010, at 20:34, Tim Landscheidt wrote: > Alban Hertroys wrote: > >> [...] >> Now the intent here is to restrict foreign keys referencing the base class >> to unitclass records that describe a baseclass and to restrict foreign keys >> referencing a derived class to unitclass records th

Re: [GENERAL] Literals in foreign key definitions

2010-02-04 Thread Tim Landscheidt
Alban Hertroys wrote: > [...] > Now the intent here is to restrict foreign keys referencing the base class to > unitclass records that describe a baseclass and to restrict foreign keys > referencing a derived class to unitclass records that do NOT describe a > baseclass. > Basically I'm trying

Re: [GENERAL] Literals in foreign key definitions

2010-02-04 Thread Tom Lane
Alban Hertroys 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

[GENERAL] Literals in foreign key definitions

2010-02-04 Thread Alban Hertroys
Hello all, I was trying something on my 8.3 server that's a bit controversial, and I wasn't surprised it didn't work. I think it would be nice if it were possible though... The case at hand is that I have a table: CREATE TABLE unitclass ( name TEXT NOT NULL PRIMARY KEY, is_baseclass BO