Skip to content

Commit 2ed7ef9

Browse files
committed
Minor cleanup of column-level priv fix
Commit 9406884 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.
1 parent e48ce4f commit 2ed7ef9

File tree

4 files changed

+0
-27
lines changed

4 files changed

+0
-27
lines changed

src/backend/commands/trigger.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@
5858
int SessionReplicationRole = SESSION_REPLICATION_ROLE_ORIGIN;
5959

6060

61-
/*
62-
* Note that this macro also exists in executor/execMain.c. There does not
63-
* appear to be any good header to put it into, given the structures that
64-
* it uses, so we let them be duplicated. Be sure to update both if one needs
65-
* to be changed, however.
66-
*/
6761
#define GetModifiedColumns(relinfo, estate) \
6862
(rt_fetch((relinfo)->ri_RangeTableIndex, (estate)->es_range_table)->modifiedCols)
6963

src/backend/executor/execMain.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ static void intorel_receive(TupleTableSlot *slot, DestReceiver *self);
8585
static void intorel_shutdown(DestReceiver *self);
8686
static void intorel_destroy(DestReceiver *self);
8787

88-
/*
89-
* Note that this macro also exists in commands/trigger.c. There does not
90-
* appear to be any good header to put it into, given the structures that
91-
* it uses, so we let them be duplicated. Be sure to update both if one needs
92-
* to be changed, however.
93-
*/
94-
#define GetModifiedColumns(relinfo, estate) \
95-
(rt_fetch((relinfo)->ri_RangeTableIndex, (estate)->es_range_table)->modifiedCols)
96-
9788
/* end of local decls */
9889

9990

src/test/regress/expected/privileges.out

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,6 @@ INSERT INTO t1 (c1, c2) VALUES (1, 1); -- fail, but row not shown
380380
ERROR: duplicate key value violates unique constraint "t1_pkey"
381381
UPDATE t1 SET c2 = 1; -- fail, but row not shown
382382
ERROR: duplicate key value violates unique constraint "t1_pkey"
383-
INSERT INTO t1 (c1, c2) VALUES (null, null); -- fail, but see columns being inserted
384-
ERROR: null value in column "c1" violates not-null constraint
385-
INSERT INTO t1 (c3) VALUES (null); -- fail, but see columns being inserted or have SELECT
386-
ERROR: null value in column "c1" violates not-null constraint
387-
INSERT INTO t1 (c1) VALUES (5); -- fail, but see columns being inserted or have SELECT
388-
ERROR: null value in column "c2" violates not-null constraint
389-
UPDATE t1 SET c3 = 10; -- fail, but see columns with SELECT rights, or being modified
390-
ERROR: new row for relation "t1" violates check constraint "t1_c3_check"
391383
SET SESSION AUTHORIZATION regressuser1;
392384
DROP TABLE t1;
393385
-- test column-level privileges when involved with DELETE

src/test/regress/sql/privileges.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ INSERT INTO t1 VALUES (3, 1, 3);
255255
SET SESSION AUTHORIZATION regressuser2;
256256
INSERT INTO t1 (c1, c2) VALUES (1, 1); -- fail, but row not shown
257257
UPDATE t1 SET c2 = 1; -- fail, but row not shown
258-
INSERT INTO t1 (c1, c2) VALUES (null, null); -- fail, but see columns being inserted
259-
INSERT INTO t1 (c3) VALUES (null); -- fail, but see columns being inserted or have SELECT
260-
INSERT INTO t1 (c1) VALUES (5); -- fail, but see columns being inserted or have SELECT
261-
UPDATE t1 SET c3 = 10; -- fail, but see columns with SELECT rights, or being modified
262258

263259
SET SESSION AUTHORIZATION regressuser1;
264260
DROP TABLE t1;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy