-- -- regproc -- /* If objects exist, return oids */ CREATE ROLE regress_regrole_test; -- without schemaname SELECT regoper('||/'); regoper --------- ||/ (1 row) SELECT regoperator('+(int4,int4)'); regoperator -------------------- +(integer,integer) (1 row) SELECT regproc('now'); regproc --------- now (1 row) SELECT regprocedure('abs(numeric)'); regprocedure -------------- abs(numeric) (1 row) SELECT regclass('pg_class'); regclass ---------- pg_class (1 row) SELECT regtype('int4'); regtype --------- integer (1 row) SELECT regcollation('"POSIX"'); regcollation -------------- "POSIX" (1 row) SELECT to_regoper('||/'); to_regoper ------------ ||/ (1 row) SELECT to_regoperator('+(int4,int4)'); to_regoperator -------------------- +(integer,integer) (1 row) SELECT to_regproc('now'); to_regproc ------------ now (1 row) SELECT to_regprocedure('abs(numeric)'); to_regprocedure ----------------- abs(numeric) (1 row) SELECT to_regclass('pg_class'); to_regclass ------------- pg_class (1 row) SELECT to_regtype('int4'); to_regtype ------------ integer (1 row) SELECT to_regcollation('"POSIX"'); to_regcollation ----------------- "POSIX" (1 row) -- with schemaname SELECT regoper('pg_catalog.||/'); regoper --------- ||/ (1 row) SELECT regoperator('pg_catalog.+(int4,int4)'); regoperator -------------------- +(integer,integer) (1 row) SELECT regproc('pg_catalog.now'); regproc --------- now (1 row) SELECT regprocedure('pg_catalog.abs(numeric)'); regprocedure -------------- abs(numeric) (1 row) SELECT regclass('pg_catalog.pg_class'); regclass ---------- pg_class (1 row) SELECT regtype('pg_catalog.int4'); regtype --------- integer (1 row) SELECT regcollation('pg_catalog."POSIX"'); regcollation -------------- "POSIX" (1 row) SELECT to_regoper('pg_catalog.||/'); to_regoper ------------ ||/ (1 row) SELECT to_regproc('pg_catalog.now'); to_regproc ------------ now (1 row) SELECT to_regprocedure('pg_catalog.abs(numeric)'); to_regprocedure ----------------- abs(numeric) (1 row) SELECT to_regclass('pg_catalog.pg_class'); to_regclass ------------- pg_class (1 row) SELECT to_regtype('pg_catalog.int4'); to_regtype ------------ integer (1 row) SELECT to_regcollation('pg_catalog."POSIX"'); to_regcollation ----------------- "POSIX" (1 row) -- schemaname not applicable SELECT regrole('regress_regrole_test'); regrole ---------------------- regress_regrole_test (1 row) SELECT regrole('"regress_regrole_test"'); regrole ---------------------- regress_regrole_test (1 row) SELECT regnamespace('pg_catalog'); regnamespace -------------- pg_catalog (1 row) SELECT regnamespace('"pg_catalog"'); regnamespace -------------- pg_catalog (1 row) SELECT to_regrole('regress_regrole_test'); to_regrole ---------------------- regress_regrole_test (1 row) SELECT to_regrole('"regress_regrole_test"'); to_regrole ---------------------- regress_regrole_test (1 row) SELECT to_regnamespace('pg_catalog'); to_regnamespace ----------------- pg_catalog (1 row) SELECT to_regnamespace('"pg_catalog"'); to_regnamespace ----------------- pg_catalog (1 row) /* If objects don't exist, raise errors. */ DROP ROLE regress_regrole_test; -- without schemaname SELECT regoper('||//'); ERROR: operator does not exist: ||// LINE 1: SELECT regoper('||//'); ^ SELECT regoperator('++(int4,int4)'); ERROR: operator does not exist: ++(int4,int4) LINE 1: SELECT regoperator('++(int4,int4)'); ^ SELECT regproc('know'); ERROR: function "know" does not exist LINE 1: SELECT regproc('know'); ^ SELECT regprocedure('absinthe(numeric)'); ERROR: function "absinthe(numeric)" does not exist LINE 1: SELECT regprocedure('absinthe(numeric)'); ^ SELECT regclass('pg_classes'); ERROR: relation "pg_classes" does not exist LINE 1: SELECT regclass('pg_classes'); ^ SELECT regtype('int3'); ERROR: type "int3" does not exist LINE 1: SELECT regtype('int3'); ^ -- with schemaname SELECT regoper('ng_catalog.||/'); ERROR: schema "ng_catalog" does not exist LINE 1: SELECT regoper('ng_catalog.||/'); ^ SELECT regoperator('ng_catalog.+(int4,int4)'); ERROR: operator does not exist: ng_catalog.+(int4,int4) LINE 1: SELECT regoperator('ng_catalog.+(int4,int4)'); ^ SELECT regproc('ng_catalog.now'); ERROR: schema "ng_catalog" does not exist LINE 1: SELECT regproc('ng_catalog.now'); ^ SELECT regprocedure('ng_catalog.abs(numeric)'); ERROR: schema "ng_catalog" does not exist LINE 1: SELECT regprocedure('ng_catalog.abs(numeric)'); ^ SELECT regclass('ng_catalog.pg_class'); ERROR: schema "ng_catalog" does not exist LINE 1: SELECT regclass('ng_catalog.pg_class'); ^ SELECT regtype('ng_catalog.int4'); ERROR: schema "ng_catalog" does not exist LINE 1: SELECT regtype('ng_catalog.int4'); ^ SELECT regcollation('ng_catalog."POSIX"'); ERROR: schema "ng_catalog" does not exist LINE 1: SELECT regcollation('ng_catalog."POSIX"'); ^ -- schemaname not applicable SELECT regrole('regress_regrole_test'); ERROR: role "regress_regrole_test" does not exist LINE 1: SELECT regrole('regress_regrole_test'); ^ SELECT regrole('"regress_regrole_test"'); ERROR: role "regress_regrole_test" does not exist LINE 1: SELECT regrole('"regress_regrole_test"'); ^ SELECT regrole('Nonexistent'); ERROR: role "nonexistent" does not exist LINE 1: SELECT regrole('Nonexistent'); ^ SELECT regrole('"Nonexistent"'); ERROR: role "Nonexistent" does not exist LINE 1: SELECT regrole('"Nonexistent"'); ^ SELECT regrole('foo.bar'); ERROR: invalid name syntax LINE 1: SELECT regrole('foo.bar'); ^ SELECT regnamespace('Nonexistent'); ERROR: schema "nonexistent" does not exist LINE 1: SELECT regnamespace('Nonexistent'); ^ SELECT regnamespace('"Nonexistent"'); ERROR: schema "Nonexistent" does not exist LINE 1: SELECT regnamespace('"Nonexistent"'); ^ SELECT regnamespace('foo.bar'); ERROR: invalid name syntax LINE 1: SELECT regnamespace('foo.bar'); ^ /* If objects don't exist, return NULL with no error. */ -- without schemaname SELECT to_regoper('||//'); to_regoper ------------ (1 row) SELECT to_regoperator('++(int4,int4)'); to_regoperator ---------------- (1 row) SELECT to_regproc('know'); to_regproc ------------ (1 row) SELECT to_regprocedure('absinthe(numeric)'); to_regprocedure ----------------- (1 row) SELECT to_regclass('pg_classes'); to_regclass ------------- (1 row) SELECT to_regtype('int3'); to_regtype ------------ (1 row) SELECT to_regcollation('notacollation'); to_regcollation ----------------- (1 row) -- with schemaname SELECT to_regoper('ng_catalog.||/'); to_regoper ------------ (1 row) SELECT to_regoperator('ng_catalog.+(int4,int4)'); to_regoperator ---------------- (1 row) SELECT to_regproc('ng_catalog.now'); to_regproc ------------ (1 row) SELECT to_regprocedure('ng_catalog.abs(numeric)'); to_regprocedure ----------------- (1 row) SELECT to_regclass('ng_catalog.pg_class'); to_regclass ------------- (1 row) SELECT to_regtype('ng_catalog.int4'); to_regtype ------------ (1 row) SELECT to_regcollation('ng_catalog."POSIX"'); to_regcollation ----------------- (1 row) -- schemaname not applicable SELECT to_regrole('regress_regrole_test'); to_regrole ------------ (1 row) SELECT to_regrole('"regress_regrole_test"'); to_regrole ------------ (1 row) SELECT to_regrole('foo.bar'); ERROR: invalid name syntax SELECT to_regrole('Nonexistent'); to_regrole ------------ (1 row) SELECT to_regrole('"Nonexistent"'); to_regrole ------------ (1 row) SELECT to_regrole('foo.bar'); ERROR: invalid name syntax SELECT to_regnamespace('Nonexistent'); to_regnamespace ----------------- (1 row) SELECT to_regnamespace('"Nonexistent"'); to_regnamespace ----------------- (1 row) SELECT to_regnamespace('foo.bar'); ERROR: invalid name syntax