Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g03Kqcm72499 for ; Thu, 3 Jan 2002 15:52:38 -0500 (EST) (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 g03Kpcg15669; Thu, 3 Jan 2002 15:51:38 -0500 (EST) To: Stephan Szabo cc: Katona Gabor , pgsql-sql@postgresql.org Subject: Re: How to union tables and have a field with UNIQUE constraint? In-reply-to: <20020103095733.C12608-100000@megazone23.bigpanda.com> References: <20020103095733.C12608-100000@megazone23.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Thu, 03 Jan 2002 10:02:07 -0800" Date: Thu, 03 Jan 2002 15:51:37 -0500 Message-ID: <15666.1010091097@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200201/23 X-Sequence-Number: 6114 Stephan Szabo writes: > I assume you want to reference id, so you'd need to do something like: > CREATE UNIQUE INDEX t_id_key ON t(id); Do we allow that (defining an index on a view)? [ tries it ] Apparently so :-( I would argue that this should be disallowed, since it does not do anything useful and can only mislead people into thinking that it has some effect. > This is a hacky sort of way to do it (we allow you to make the internal > form that a unique constraint has via create index even on views which > I don't believe would ever be used :( ) and may not continue working > forever. Since triggers on a view won't do anything either, I don't see how one could expect REFERENCES to a view to work. The system ought to reject all this stuff as unimplemented. regards, tom lane