Filter: (f_leak(my_credit_card_usage_secure.cnum) AND (my_credit_card_usage_secure.ymd >= '10-01-2011'::date) AND (my_credit_card_usage_secure.ymd < '11-01-2011'::date))
-> Hash Join
Hash Cond: (r.cid = l.cid)
-> Seq Scan on credit_usage r
-> Hash
-> Hash Join
Hash Cond: (r.cid = l.cid)
-> Seq Scan on credit_card r
-> Hash
-> Seq Scan on customer l
Filter: (name = ("current_user"())::text)
(12 rows)
--
-- Test for the case when security_barrier gets changed between rewriter
-- and planner stage.
--
PREPARE p1 AS SELECT * FROM my_property_normal WHERE f_leak(passwd);
PREPARE p2 AS SELECT * FROM my_property_secure WHERE f_leak(passwd);
EXECUTE p1;
NOTICE: f_leak => passwd123
NOTICE: f_leak => beafsteak
NOTICE: f_leak => hamburger
cid | name | tel | passwd
-----+-------+------------------+-----------
101 | alice | +81-12-3456-7890 | passwd123
(1 row)
EXECUTE p2;
NOTICE: f_leak => passwd123
cid | name | tel | passwd
-----+-------+------------------+-----------
101 | alice | +81-12-3456-7890 | passwd123
(1 row)
RESET SESSION AUTHORIZATION;
ALTER VIEW my_property_normal SET (security_barrier=true);
ALTER VIEW my_property_secure SET (security_barrier=false);
SET SESSION AUTHORIZATION alice;
EXECUTE p1; -- To be perform as a view with security-barrier
NOTICE: f_leak => passwd123
cid | name | tel | passwd
-----+-------+------------------+-----------
101 | alice | +81-12-3456-7890 | passwd123
(1 row)
EXECUTE p2; -- To be perform as a view without security-barrier
Filter: (f_leak(my_credit_card_usage_secure.cnum) AND (my_credit_card_usage_secure.ymd >= '10-01-2011'::date) AND (my_credit_card_usage_secure.ymd < '11-01-2011'::date))
-> Hash Join
Hash Cond: (r.cid = l.cid)
-> Seq Scan on credit_usage r
-> Hash
-> Hash Join
Hash Cond: (r.cid = l.cid)
-> Seq Scan on credit_card r
-> Hash
-> Seq Scan on customer l
Filter: (name = ("current_user"())::text)
(12 rows)
--
-- Test for the case when security_barrier gets changed between rewriter
-- and planner stage.
--
PREPARE p1 AS SELECT * FROM my_property_normal WHERE f_leak(passwd);
PREPARE p2 AS SELECT * FROM my_property_secure WHERE f_leak(passwd);
EXECUTE p1;
NOTICE: f_leak => passwd123
NOTICE: f_leak => beafsteak
NOTICE: f_leak => hamburger
cid | name | tel | passwd
-----+-------+------------------+-----------
101 | alice | +81-12-3456-7890 | passwd123
(1 row)
EXECUTE p2;
NOTICE: f_leak => passwd123
cid | name | tel | passwd
-----+-------+------------------+-----------
101 | alice | +81-12-3456-7890 | passwd123
(1 row)
RESET SESSION AUTHORIZATION;
ALTER VIEW my_property_normal SET (security_barrier=true);
ALTER VIEW my_property_secure SET (security_barrier=false);
SET SESSION AUTHORIZATION alice;
EXECUTE p1; -- To be perform as a view with security-barrier
NOTICE: f_leak => passwd123
cid | name | tel | passwd
-----+-------+------------------+-----------
101 | alice | +81-12-3456-7890 | passwd123
(1 row)
EXECUTE p2; -- To be perform as a view without security-barrier