Re: ENABLE/DISABLE CONSTRAINT NAME

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: ENABLE/DISABLE CONSTRAINT NAME
Дата
Msg-id 523230E5.9050708@gmx.net
обсуждение исходный текст
Ответ на Re: ENABLE/DISABLE CONSTRAINT NAME  (wangshuo@highgo.com.cn)
Ответы Re: ENABLE/DISABLE CONSTRAINT NAME  (wangshuo@highgo.com.cn)
Список pgsql-hackers
On 9/11/13 1:09 AM, wangshuo@highgo.com.cn wrote:
> Peter Eisentraut wrote:
>> Note that other schema objects can depend on the existence of
>> constraints.  For example, the validity of a view might depend on the
>> existence of a primary key constraint.  What would you do with the view
>> if the primary key constraint is temporarily disabled?
>>
> 
> Thanks for your reply.
>  I could't  clearly understand your opinion,  could you give  me more
> information or example?

=> create table test1 (a int constraint pk primary key, b text);
=> create view test2 as select a, b from test1 group by a;
=> alter table test1 drop constraint pk;
ERROR:  2BP01: cannot drop constraint pk on table test1 because other
objects depend on it
DETAIL:  view test2 depends on constraint pk on table test1
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

(This has to do with whether ungrouped columns are allowed in the select
list when the presence of constraints ensures well-defined results.)

When trying to drop the constraint, the choice is to abort the drop or
to drop dependent objects.  When you are talking about
enabling/disabling the constraint, it's not clear what to do.




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

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: lcr v5 - primary/candidate key in relcache
Следующее
От: Kevin Grittner
Дата:
Сообщение: record identical operator