Since PostgreSQL 15 it is possible to set security_invoker
on views. I was wondering how to check if my views have it enabled or not, as neither pgAdmin nor DataGrip doesn't show that.
Asked
Active
Viewed 84 times
1

MegaCookie
- 5,017
- 3
- 21
- 25
-
Are you using the latest pgAdmin? It is a fairly new feature. – Laurenz Albe Apr 02 '23 at 05:10
-
Yes, version 6.21. Do you know if it is actually possible to see it there somewhere? – MegaCookie Apr 02 '23 at 08:38
-
1I just checked, and support for that is really missing. I'd call that a bug, because it shows the view definition incorrectly. You should report that to pgAdmin. – Laurenz Albe Apr 03 '23 at 06:17
-
1I've created an new issue for pgAdmin on Github: https://github.com/pgadmin-org/pgadmin4/issues/6099 – MegaCookie Apr 06 '23 at 11:16
1 Answers
1
Here is an example to check all views in the public
schema:
select
relname,
case
when lower(reloptions::text)::text[] && array['security_invoker=1','security_invoker=true','security_invoker=on']
then true else false
end as security_invoker
from pg_class
join pg_catalog.pg_namespace n on n.oid = pg_class.relnamespace
where n.nspname = 'public' and relkind='v';
In the internal pg_class
table there is a column called reloptions
which knows if the security_invoker
is turned on.
Example output for reloptions
: {security_invoker=true}
and {security_invoker=on}
or is null
by default if it isn't turned on.

MegaCookie
- 5,017
- 3
- 21
- 25