]> granicus.if.org Git - postgresql/commitdiff
Minor cleanup of column-level priv fix
authorStephen Frost <sfrost@snowman.net>
Tue, 17 Feb 2015 20:36:51 +0000 (15:36 -0500)
committerStephen Frost <sfrost@snowman.net>
Tue, 17 Feb 2015 20:36:51 +0000 (15:36 -0500)
Commit 9406884af19e2620a14059e64d4eb6ab430ab328 cleaned up
column-privilege related leaks in various error-message paths, but ended
up including a few more things than it should have in the back branches.

Specifically, there's no need for the GetModifiedColumns macro in
execMain.c as 9.1 and older didn't include the row in check constraint
violations.  Further, the regression tests added to check those cases
aren't necessary.

This patch removes the GetModifiedColumns macro from execMain.c, removes
the comment which was added to trigger.c related to the duplicate macro
definition, and removes the check-constraint-related regression tests.

Pointed out by Robert.

Back-patched to 9.1 and 9.0.

src/backend/commands/trigger.c
src/backend/executor/execMain.c
src/test/regress/expected/privileges.out
src/test/regress/sql/privileges.sql

index 1becace82c49faaaadc0f1de4e192e9643f8fa53..f88a0e0778d46f06e6bc9402ec349acab6702824 100644 (file)
 int                    SessionReplicationRole = SESSION_REPLICATION_ROLE_ORIGIN;
 
 
-/*
- * Note that this macro also exists in executor/execMain.c.  There does not
- * appear to be any good header to put it into, given the structures that
- * it uses, so we let them be duplicated.  Be sure to update both if one needs
- * to be changed, however.
- */
 #define GetModifiedColumns(relinfo, estate) \
        (rt_fetch((relinfo)->ri_RangeTableIndex, (estate)->es_range_table)->modifiedCols)
 
index f101226fdd2f534974064aedeb903defe7bf595e..19bfcd3e5ba7237ab95215660086eb4163ba78bf 100644 (file)
@@ -85,15 +85,6 @@ static void intorel_receive(TupleTableSlot *slot, DestReceiver *self);
 static void intorel_shutdown(DestReceiver *self);
 static void intorel_destroy(DestReceiver *self);
 
-/*
- * Note that this macro also exists in commands/trigger.c.  There does not
- * appear to be any good header to put it into, given the structures that
- * it uses, so we let them be duplicated.  Be sure to update both if one needs
- * to be changed, however.
- */
-#define GetModifiedColumns(relinfo, estate) \
-       (rt_fetch((relinfo)->ri_RangeTableIndex, (estate)->es_range_table)->modifiedCols)
-
 /* end of local decls */
 
 
index dfeb5bde12b856810e2df5cebd47b029add1cd22..de2f6d11b5f77cf26212768473742413b8631a9b 100644 (file)
@@ -380,14 +380,6 @@ INSERT INTO t1 (c1, c2) VALUES (1, 1); -- fail, but row not shown
 ERROR:  duplicate key value violates unique constraint "t1_pkey"
 UPDATE t1 SET c2 = 1; -- fail, but row not shown
 ERROR:  duplicate key value violates unique constraint "t1_pkey"
-INSERT INTO t1 (c1, c2) VALUES (null, null); -- fail, but see columns being inserted
-ERROR:  null value in column "c1" violates not-null constraint
-INSERT INTO t1 (c3) VALUES (null); -- fail, but see columns being inserted or have SELECT
-ERROR:  null value in column "c1" violates not-null constraint
-INSERT INTO t1 (c1) VALUES (5); -- fail, but see columns being inserted or have SELECT
-ERROR:  null value in column "c2" violates not-null constraint
-UPDATE t1 SET c3 = 10; -- fail, but see columns with SELECT rights, or being modified
-ERROR:  new row for relation "t1" violates check constraint "t1_c3_check"
 SET SESSION AUTHORIZATION regressuser1;
 DROP TABLE t1;
 -- test column-level privileges when involved with DELETE
index f3cc04bd1d378c45fba9cfecfb408ff18d668b80..53ab509c0046f50bdc4fca8c1c94208b39a1b066 100644 (file)
@@ -255,10 +255,6 @@ INSERT INTO t1 VALUES (3, 1, 3);
 SET SESSION AUTHORIZATION regressuser2;
 INSERT INTO t1 (c1, c2) VALUES (1, 1); -- fail, but row not shown
 UPDATE t1 SET c2 = 1; -- fail, but row not shown
-INSERT INTO t1 (c1, c2) VALUES (null, null); -- fail, but see columns being inserted
-INSERT INTO t1 (c3) VALUES (null); -- fail, but see columns being inserted or have SELECT
-INSERT INTO t1 (c1) VALUES (5); -- fail, but see columns being inserted or have SELECT
-UPDATE t1 SET c3 = 10; -- fail, but see columns with SELECT rights, or being modified
 
 SET SESSION AUTHORIZATION regressuser1;
 DROP TABLE t1;