The list of all the queries

Number of views with and without security barrier

Query goal: Find the number of views, the number of views with and without security barrier setting, and the names of views with and without the security barrier setting.
Query type: Sofware measure (Numeric values (software measures) about the database)
Query license: MIT License
Data source: INFORMATION_SCHEMA+system catalog
SQL query: Click on query to copy it

SELECT 
Count(*) AS nr,
Count(*) FILTER (WHERE 'security_barrier=true'=ANY(pg_catalog.pg_class.reloptions) ) AS nr_of_security_barrier_views,
Count(*) FILTER (WHERE (('security_barrier=true'<>ALL(pg_catalog.pg_class.reloptions)) OR pg_catalog.pg_class.reloptions IS NULL) AND pg_get_viewdef(pg_class.oid)~*'WHERE[[:space:]]') AS nr_of_non_security_barrier_views_with_where,
Count(*) FILTER (WHERE ('security_barrier=true'<>ALL(pg_catalog.pg_class.reloptions)) OR pg_catalog.pg_class.reloptions IS NULL) AS nr_of_non_security_barrier_views,
string_agg(nspname || '.' || relname ,',<br>' ORDER BY nspname , relname ) FILTER (WHERE 'security_barrier=true'=ANY(pg_catalog.pg_class.reloptions) ) AS security_barrier_views,
string_agg(nspname || '.' || relname ,',<br>' ORDER BY nspname , relname ) FILTER (WHERE ('security_barrier=true'<>ALL(pg_catalog.pg_class.reloptions)) OR pg_catalog.pg_class.reloptions IS NULL) AS non_security_barrier_views
FROM 
  pg_catalog.pg_class, 
  pg_catalog.pg_namespace
WHERE pg_catalog.pg_class.relnamespace=pg_catalog.pg_namespace.oid
AND relkind='v'
AND nspname NOT IN (SELECT schema_name
FROM information_schema.schemata
WHERE schema_name<>'public' AND
schema_owner='postgres' AND schema_name IS NOT NULL);

Collections where the query belongs to

Collection nameCollection description
Find problems by overviewQueries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .
Find quick numeric overview of the databaseQueries that return numeric values showing mostly the number of different types of database objects in the database

Categories where the query belongs to

Category nameCategory description
Derived tablesQueries of this category provide information about the derived tables (views, materialized views), which are used to implement virtual data layer.

Reference materials for further reading

Reference
https://www.2ndquadrant.com/en/blog/how-do-postgresql-security_barrier-views-work/

The list of all the queries