Document default privileges on functions

This commit is contained in:
Esther Lozano 2019-11-07 15:03:46 +01:00
parent f06b899605
commit 8a4a59b340

View File

@ -2,7 +2,7 @@
\set QUIET on \set QUIET on
SET client_min_messages TO error; SET client_min_messages TO error;
-- The permission error changed between pre PG11 and post 11 (before everythin "relation", now it's "view", "table" and so on -- The permission error changed between pre PG11 and post 11 (before everything was "relation", now it's "view", "table" and so on
CREATE OR REPLACE FUNCTION catch_permission_error(query text) CREATE OR REPLACE FUNCTION catch_permission_error(query text)
RETURNS bool RETURNS bool
AS $$ AS $$
@ -44,6 +44,8 @@ SELECT * FROM test_view;
SELECT * FROM test_mview; SELECT * FROM test_mview;
SELECT * FROM test_selectinto; SELECT * FROM test_selectinto;
SELECT test_function(); SELECT test_function();
-- Postgres grants default execute privilege on functions to PUBLIC. So in order to check the different permissions
-- between creator and owner roles is not enough with performing a selection, we need to DROP the table (which only the owner can do)
DROP FUNCTION test_function(); DROP FUNCTION test_function();
\set QUIET on \set QUIET on