Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C295B478A19 for ; Wed, 29 Jan 2003 01:59:19 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 204AC4799E8 for ; Wed, 29 Jan 2003 01:03:03 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 847DED600; Tue, 28 Jan 2003 22:03:02 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 7A3915C03; Tue, 28 Jan 2003 22:03:02 -0800 (PST) Date: Tue, 28 Jan 2003 22:03:02 -0800 (PST) From: Stephan Szabo To: Rodger Donaldson Cc: Subject: Re: Cross-table constraints In-Reply-To: <20030128070514.GB7146@diaspora.gen.nz> Message-ID: <20030128215859.W4312-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/471 X-Sequence-Number: 11336 On Tue, 28 Jan 2003, Rodger Donaldson wrote: > Now, adding a UNIQUE constraint on the pk for add_queue weeds out > dupes there. However, attempting to add a cross-table UNIQUE check > with: > > alter table add_queue add constraint add_queue_no_dupe_sites unique > (sites.url); > ERROR: parser: parse error at or near "." > > ,,,fails. Foreign key constraints will only require a match (of one > sort or another) in the foreign table, according to the postgresql 7.2 > documentation, and do not have an option to require no match. > > Am I missing something obvious (syntax for UNIQUE, for example), or > trying to do something that just doesn't work that way? I'm not sure what a unique constraint on sites.url on table add_queue is supposed to mean precisely. You can probably come pretty close by making a set of triggers on both tables however.