Re: ENABLE/DISABLE CONSTRAINT NAME - Mailing list pgsql-hackers

From Robert Haas
Subject Re: ENABLE/DISABLE CONSTRAINT NAME
Date
Msg-id CA+TgmoabJW1D3+xxXkeqH43DKyqPzqk9V4bB0im8wRO09zroLg@mail.gmail.com
Whole thread Raw
In response to Re: ENABLE/DISABLE CONSTRAINT NAME  (wangshuo@highgo.com.cn)
Responses Re: ENABLE/DISABLE CONSTRAINT NAME
List pgsql-hackers
On Thu, Sep 12, 2013 at 10:03 PM,  <wangshuo@highgo.com.cn> wrote:
> Second, I tested the check and the foreign key constraint as your test
> above.
> And no error found, as fellow:

You're missing the point.  Peter wasn't worried that your patch throws
an error; he's concerned about the fact that it doesn't.

In PostgreSQL, you can only create the following view because test1
has a primary key over column a:

=> 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;

The reason that, if the primary key weren't there, it would be
ambiguous which row should be returned as among multiple values where
a is equal and b is not.  If you can disable the constraint, then you
can create precisely that problem.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Richard Poole
Date:
Subject: patch: add MAP_HUGETLB to mmap() where supported (WIP)
Next
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] Add transforms feature