Re: Meta integrity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Renato De Giovanni <rdg(at)viafractal(dot)com(dot)br>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Meta integrity
Date: 2001-07-27 05:20:26
Message-ID: 26279.996211226@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Renato De Giovanni <rdg(at)viafractal(dot)com(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Philip Warner 2001-07-27 07:50:49 Re: Re: Restriction by grouping problem.
Previous Message Philip Warner 2001-07-27 01:47:13 Re: Re: Restriction by grouping problem.