pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Renato De Giovanni <rdg@viafractal.com.br>
Cc: pgsql-sql@postgresql.org
Subject: Re: Meta integrity
Date: Fri, 27 Jul 2001 01:20:26 -0400
Message-ID: <26279.996211226@sss.pgh.pa.us> (raw)
In-Reply-To: <3B5EE103.BCB37659@viafractal.com.br>
References: <3B5EE103.BCB37659@viafractal.com.br>

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



view thread (5+ messages)

Message-ID: <26279.996211226@sss.pgh.pa.us>
Permalink:  ../26279.996211226@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26279.996211226@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rdg@viafractal.com.br
  Subject: Re: Meta integrity
  In-Reply-To: <26279.996211226@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox