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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to union tables and have a field with UNIQUE constraint?
Дата
Msg-id 15666.1010091097@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: How to union tables and have a field with UNIQUE constraint?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: How to union tables and have a field with UNIQUE constraint?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: How to union tables and have a field with UNIQUE constraint?  (Katona Gabor <katonag@dragon.klte.hu>)
Список pgsql-sql
Stephan Szabo <sszabo@megazone23.bigpanda.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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: How to union tables and have a field with UNIQUE constraint?
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: pltcl function -> plpgsql