SELECT n.nspname as "Schema",
       c.relname as "Table",
       c.relacl as "Access Privileges"
FROM pg_catalog.pg_class c
     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace,
     (SELECT $1 AS cmd) AS cmd,
     pg_catalog.pg_name_pattern($2) AS (schpat text, nsppat text)
WHERE c.relkind IN ('r', 'v', 'S')
  AND n.nspname ~ schpat
  AND c.relname ~ nsppat
ORDER BY 1, 2