Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6R5KXf78897 for ; Fri, 27 Jul 2001 01:20:33 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f6R5KQC26282; Fri, 27 Jul 2001 01:20:27 -0400 (EDT) To: Renato De Giovanni cc: pgsql-sql@postgresql.org Subject: Re: Meta integrity In-reply-to: <3B5EE103.BCB37659@viafractal.com.br> References: <3B5EE103.BCB37659@viafractal.com.br> Comments: In-reply-to Renato De Giovanni message dated "Wed, 25 Jul 2001 12:08:51 -0300" Date: Fri, 27 Jul 2001 01:20:26 -0400 Message-ID: <26279.996211226@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200107/354 X-Sequence-Number: 4168 Renato De Giovanni 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