postgres.git / summary / log / commit / refs

commit    cfc14b2bf348528bc8f0f04fe1ff80e7abdf0529
Author:   Stephen Frost <sfrost@snowman.net>
Date:     Tue Feb 17 20:36:24 2015 +0000
First released in: 9.0.20, 9.1.16

    Minor cleanup of column-level priv fix
    
    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 | 6 ------ src/backend/executor/execMain.c | 9 --------- src/test/regress/expected/privileges.out | 8 -------- src/test/regress/sql/privileges.sql | 4 ---- 4 files changed, 27 deletions(-) diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index bbb83911a9a..bd5dee4286a 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -60,12 +60,6 @@ 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) diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 8ff6ede7714..cd0def4aab9 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -95,15 +95,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 */ diff --git a/src/test/regress/expected/privileges.out b/src/test/regress/expected/privileges.out index dfeb5bde12b..de2f6d11b5f 100644 --- a/src/test/regress/expected/privileges.out +++ b/src/test/regress/expected/privileges.out @@ -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 diff --git a/src/test/regress/sql/privileges.sql b/src/test/regress/sql/privileges.sql index f3cc04bd1d3..53ab509c004 100644 --- a/src/test/regress/sql/privileges.sql +++ b/src/test/regress/sql/privileges.sql @@ -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; [parent: 64e0458383c1]