SELECT n.nspname as "Schema",
       o.oprname AS "Name",
       CASE WHEN o.oprkind='l' THEN NULL
            ELSE pg_catalog.format_type(o.oprleft, NULL)
       END AS "Left arg type",
       CASE WHEN o.oprkind='r' THEN NULL
            ELSE pg_catalog.format_type(o.oprright, NULL)
       END AS "Right arg type",
       pg_catalog.format_type(o.oprresult, NULL) AS "Result type",
       coalesce(pg_catalog.obj_description(o.oid, 'pg_operator'),
                pg_catalog.obj_description(o.oprcode, 'pg_proc')) AS "Description"
FROM pg_catalog.pg_operator o
     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace,
     (SELECT $1 AS cmd) AS cmd,
     pg_catalog.pg_name_pattern($2) AS (schpat text, oprpat text)
WHERE pg_catalog.pg_operator_is_visible(o.oid)
      AND n.nspname ~ schpat
      AND o.oprname ~ oprpat
ORDER BY 1, 2, 3, 4