SELECT n.nspname AS "Name",
       u.usename AS "Owner"
FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u
       ON n.nspowner=u.usesysid,
     (SELECT $1 AS cmd) AS cmd,
     pg_catalog.pg_name_pattern($2) AS (schpat text, nsppat text)
WHERE n.nspname ~ nsppat
ORDER BY 1