Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Date: 2011-02-04 04:00:13
Message-ID: AANLkTi=UpWWSu8y3KkJGWEgY2_oxV9Fg8VQVXoJxRCJp@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 14, 2011 at 6:15 AM, Simon Riggs <simon(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2011-02-04 04:02:14 Compilation failed
Previous Message Scott Marlowe 2011-02-04 04:00:01 Re: [HACKERS] Slow count(*) again...