Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED - Mailing list pgsql-hackers

From Robert Haas
Subject Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Date
Msg-id AANLkTi=UpWWSu8y3KkJGWEgY2_oxV9Fg8VQVXoJxRCJp@mail.gmail.com
Whole thread Raw
In response to Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
List pgsql-hackers
On Fri, Jan 14, 2011 at 6:15 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> Patch to implement the proposed feature attached, for CFJan2011.
>
> 2 sub-command changes:
>
> ALTER TABLE foo ADD FOREIGN KEY fkoo ... NOT VALID;
>
> ALTER TABLE foo VALIDATE CONSTRAINT fkoo;

This patch, which seems to be the latest version, no longer applies,
and has not been updated based on the previous provided review
comments.

Also, this diff hunk looks scary to me:

+       if (must_use_query)
+               ereport(ERROR,
+                               (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+                                errmsg("cannot SELECT from primary
key of relation \"%s\"",
+                                               RelationGetRelationName(rel))));
+

What's the justification for that?

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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: We need to log aborted autovacuums
Next
From: Fujii Masao
Date:
Subject: Compilation failed