Restore erroneously removed ONLY from PK check
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 4 Apr 2018 19:36:21 +0000 (16:36 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 4 Apr 2018 19:38:11 +0000 (16:38 -0300)
This is a blind fix, since I don't have SE-Linux to verify it.

Per unwanted change in rhinoceros, running sepgsql tests.  Noted by Tom
Lane.

Discussion: https://postgr.es/m/32347.1522865050@sss.pgh.pa.us

src/backend/utils/adt/ri_triggers.c

index 90ddbe55167ea3bafad33106c51264b028370af0..fc034ce601929e0ea40b0b1dcad6371665961872 100644 (file)
@@ -1915,7 +1915,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel)
        /*----------
         * The query string built is:
         *      SELECT fk.keycols FROM [ONLY] relname fk
-        *       LEFT OUTER JOIN pkrelname pk
+        *       LEFT OUTER JOIN ONLY pkrelname pk
         *       ON (pk.pkkeycol1=fk.keycol1 [AND ...])
         *       WHERE pk.pkkeycol1 IS NULL AND
         * For MATCH SIMPLE:
@@ -1943,7 +1943,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel)
        fk_only = fk_rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE ?
                "" : "ONLY ";
        appendStringInfo(&querybuf,
-                                        " FROM %s%s fk LEFT OUTER JOIN %s pk ON",
+                                        " FROM %s%s fk LEFT OUTER JOIN ONLY %s pk ON",
                                         fk_only, fkrelname, pkrelname);
 
        strcpy(pkattname, "pk.");