Received: from megazone.bigpanda.com ([63.150.15.178]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fAHL6Dm21665 for ; Sat, 17 Nov 2001 16:06:13 -0500 (EST) (envelope-from sszabo@megazone23.bigpanda.com) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 79051D5E2; Sat, 17 Nov 2001 13:06:14 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 6CB1F5BE4; Sat, 17 Nov 2001 13:06:14 -0800 (PST) Date: Sat, 17 Nov 2001 13:06:14 -0800 (PST) From: Stephan Szabo To: Horst Herb Cc: Subject: Re: constraint via selection In-Reply-To: <20011117125544.6028.qmail@gnumed.dhs.org> Message-ID: <20011117122714.M31141-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200111/254 X-Sequence-Number: 5636 On Sun, 18 Nov 2001, Horst Herb wrote: > > What would the most efficient formulation of the "check" constraint be > > in this case? > > Sorry, I probably should reformulate my question into "is there a more > effficient constraint than a foreign key constraint for this simple > problem"? Hmm, it depends. You probably can't manage it through check constraints unless you knew the values (at which point you might not even the other table) since I'm pretty sure we don't support check constraints with subselects in them. It's possible that for your application you could manage to make a trigger that beats the foreign key constraint and do it that way.