a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
2 | bcd
4 | def
2 | yyy
SELECT * FROM t1 WHERE f_leak(b);
NOTICE: f_leak => bbb
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
NOTICE: f_leak => bcd
NOTICE: f_leak => def
NOTICE: f_leak => yyy
a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
2 | bcd
4 | def
2 | yyy
oid | a | b
-----+---+-----
102 | 2 | bbb
- 104 | 4 | ddd
+ 104 | 4 | dad
202 | 2 | bcd
204 | 4 | def
302 | 2 | yyy
a | b | t1
---+-----+---------
2 | bbb | (2,bbb)
- 4 | ddd | (4,ddd)
+ 4 | dad | (4,dad)
2 | bcd | (2,bcd)
4 | def | (4,def)
2 | yyy | (2,yyy)
a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
2 | bcd
4 | def
2 | yyy
SELECT * FROM t1 WHERE f_leak(b) FOR SHARE;
NOTICE: f_leak => bbb
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
NOTICE: f_leak => bcd
NOTICE: f_leak => def
NOTICE: f_leak => yyy
a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
2 | bcd
4 | def
2 | yyy
NOTICE: f_leak => aba
NOTICE: f_leak => bbb
NOTICE: f_leak => ccc
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
NOTICE: f_leak => abc
NOTICE: f_leak => bcd
NOTICE: f_leak => cde
1 | aba
2 | bbb
3 | ccc
- 4 | ddd
+ 4 | dad
1 | abc
2 | bcd
3 | cde
NOTICE: f_leak => aba
NOTICE: f_leak => bbb
NOTICE: f_leak => ccc
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
NOTICE: f_leak => abc
NOTICE: f_leak => bcd
NOTICE: f_leak => cde
1 | aba
2 | bbb
3 | ccc
- 4 | ddd
+ 4 | dad
1 | abc
2 | bcd
3 | cde
NOTICE: f_leak => aba
NOTICE: f_leak => bbb
NOTICE: f_leak => ccc
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
NOTICE: f_leak => abc
NOTICE: f_leak => bcd
NOTICE: f_leak => cde
1 | aba
2 | bbb
3 | ccc
- 4 | ddd
+ 4 | dad
1 | abc
2 | bcd
3 | cde
UPDATE t1 SET b = b || b WHERE f_leak(b);
NOTICE: f_leak => bbb
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
NOTICE: f_leak => bcd
NOTICE: f_leak => def
NOTICE: f_leak => yyy
UPDATE only t1 SET b = b || '_updt' WHERE f_leak(b);
NOTICE: f_leak => bbbbbb
-NOTICE: f_leak => dddddd
+NOTICE: f_leak => daddad
-- returning clause with system column
UPDATE only t1 SET b = b WHERE f_leak(b) RETURNING oid, *, t1;
NOTICE: f_leak => bbbbbb_updt
-NOTICE: f_leak => dddddd_updt
+NOTICE: f_leak => daddad_updt
oid | a | b | t1
-----+---+-------------+-----------------
102 | 2 | bbbbbb_updt | (2,bbbbbb_updt)
- 104 | 4 | dddddd_updt | (4,dddddd_updt)
+ 104 | 4 | daddad_updt | (4,daddad_updt)
(2 rows)
UPDATE t1 SET b = b WHERE f_leak(b) RETURNING *;
NOTICE: f_leak => bbbbbb_updt
-NOTICE: f_leak => dddddd_updt
+NOTICE: f_leak => daddad_updt
NOTICE: f_leak => bcdbcd
NOTICE: f_leak => defdef
NOTICE: f_leak => yyyyyy
a | b
---+-------------
2 | bbbbbb_updt
- 4 | dddddd_updt
+ 4 | daddad_updt
2 | bcdbcd
4 | defdef
2 | yyyyyy
UPDATE t1 SET b = b WHERE f_leak(b) RETURNING oid, *, t1;
NOTICE: f_leak => bbbbbb_updt
-NOTICE: f_leak => dddddd_updt
+NOTICE: f_leak => daddad_updt
NOTICE: f_leak => bcdbcd
NOTICE: f_leak => defdef
NOTICE: f_leak => yyyyyy
oid | a | b | t1
-----+---+-------------+-----------------
102 | 2 | bbbbbb_updt | (2,bbbbbb_updt)
- 104 | 4 | dddddd_updt | (4,dddddd_updt)
+ 104 | 4 | daddad_updt | (4,daddad_updt)
202 | 2 | bcdbcd | (2,bcdbcd)
204 | 4 | defdef | (4,defdef)
302 | 2 | yyyyyy | (2,yyyyyy)
UPDATE t1 t1_1 SET b = t1_2.b FROM t1 t1_2
WHERE t1_1.a = 4 AND t1_2.a = t1_1.a AND t1_2.b = t1_1.b
AND f_leak(t1_1.b) AND f_leak(t1_2.b) RETURNING *, t1_1, t1_2;
-NOTICE: f_leak => dddddd_updt
-NOTICE: f_leak => dddddd_updt
+NOTICE: f_leak => daddad_updt
+NOTICE: f_leak => daddad_updt
NOTICE: f_leak => defdef
NOTICE: f_leak => defdef
-NOTICE: f_leak => dddddd_updt
+NOTICE: f_leak => daddad_updt
NOTICE: f_leak => defdef
a | b | a | b | t1_1 | t1_2
---+-------------+---+-------------+-----------------+-----------------
- 4 | dddddd_updt | 4 | dddddd_updt | (4,dddddd_updt) | (4,dddddd_updt)
+ 4 | daddad_updt | 4 | daddad_updt | (4,daddad_updt) | (4,daddad_updt)
4 | defdef | 4 | defdef | (4,defdef) | (4,defdef)
(2 rows)
3 | ccc
3 | cde
3 | zzz
- 4 | dddddd_updt
+ 4 | daddad_updt
4 | defdef
(11 rows)
DELETE FROM only t1 WHERE f_leak(b) RETURNING oid, *, t1;
NOTICE: f_leak => bbbbbb_updt
-NOTICE: f_leak => dddddd_updt
+NOTICE: f_leak => daddad_updt
oid | a | b | t1
-----+---+-------------+-----------------
102 | 2 | bbbbbb_updt | (2,bbbbbb_updt)
- 104 | 4 | dddddd_updt | (4,dddddd_updt)
+ 104 | 4 | daddad_updt | (4,daddad_updt)
(2 rows)
DELETE FROM t1 WHERE f_leak(b) RETURNING oid, *, t1;
(1, 'aba'),
(2, 'bbb'),
(3, 'ccc'),
- (4, 'ddd');
+ (4, 'dad');
CREATE POLICY p1 ON z1 TO regress_rls_group1 USING (a % 2 = 0);
CREATE POLICY p2 ON z1 TO regress_rls_group2 USING (a % 2 = 1);
ALTER TABLE z1 ENABLE ROW LEVEL SECURITY;
SET SESSION AUTHORIZATION regress_rls_bob;
SELECT * FROM z1 WHERE f_leak(b);
NOTICE: f_leak => bbb
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
(2 rows)
EXPLAIN (COSTS OFF) SELECT * FROM z1 WHERE f_leak(b);
SET ROLE regress_rls_group1;
SELECT * FROM z1 WHERE f_leak(b);
NOTICE: f_leak => bbb
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
(2 rows)
EXPLAIN (COSTS OFF) SELECT * FROM z1 WHERE f_leak(b);
NOTICE: f_leak => aba
NOTICE: f_leak => bbb
NOTICE: f_leak => ccc
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
a | b
---+-----
1 | aba
2 | bbb
3 | ccc
- 4 | ddd
+ 4 | dad
(4 rows)
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
NOTICE: f_leak => aba
NOTICE: f_leak => bbb
NOTICE: f_leak => ccc
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
a | b
---+-----
1 | aba
2 | bbb
3 | ccc
- 4 | ddd
+ 4 | dad
(4 rows)
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
SET SESSION AUTHORIZATION regress_rls_alice;
SELECT * FROM rls_view;
NOTICE: f_leak => bbb
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
(2 rows)
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
SET SESSION AUTHORIZATION regress_rls_bob;
SELECT * FROM rls_view;
NOTICE: f_leak => bbb
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
(2 rows)
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;
GRANT SELECT ON rls_view TO regress_rls_carol;
SELECT * FROM rls_view;
NOTICE: f_leak => bbb
-NOTICE: f_leak => ddd
+NOTICE: f_leak => dad
a | b
---+-----
2 | bbb
- 4 | ddd
+ 4 | dad
(2 rows)
EXPLAIN (COSTS OFF) SELECT * FROM rls_view;