Re: Meta integrity - Mailing list pgsql-sql

From Tom Lane
Subject Re: Meta integrity
Date
Msg-id 26279.996211226@sss.pgh.pa.us
Whole thread Raw
In response to Meta integrity  (Renato De Giovanni <rdg@viafractal.com.br>)
List pgsql-sql
Renato De Giovanni <rdg@viafractal.com.br> writes:
>        FOREIGN KEY (object_id, 'X') REFERENCES object (id, class_id)

Why not just store the class_id in the secondary table (if you're
concerned about space, consider using an int4 to represent class_id).
Then you can do a direct two-column foreign key constraint, plus add
a check constraint like CHECK(class_id = 'X').
        regards, tom lane


pgsql-sql by date:

Previous
From: Philip Warner
Date:
Subject: Re: Re: Restriction by grouping problem.
Next
From: Philip Warner
Date:
Subject: Re: Re: Restriction by grouping problem.