Re: How to union tables and have a field with UNIQUE constraint?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Katona Gabor <katonag(at)dragon(dot)klte(dot)hu>, pgsql-sql(at)postgresql(dot)org
Subject: Re: How to union tables and have a field with UNIQUE constraint?
Date: 2002-01-03 20:51:37
Message-ID: 15666.1010091097@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2002-01-03 21:01:02 Re: pltcl function -> plpgsql
Previous Message Stephan Szabo 2002-01-03 18:02:07 Re: How to union tables and have a field with UNIQUE constraint?