2014-04-08 16:27:56 +02:00
|
|
|
--
|
|
|
|
-- regproc
|
|
|
|
--
|
|
|
|
/* If objects exist, return oids */
|
2015-05-09 19:06:49 +02:00
|
|
|
CREATE ROLE regtestrole;
|
2014-04-08 16:27:56 +02:00
|
|
|
-- without schemaname
|
|
|
|
SELECT regoper('||/');
|
|
|
|
regoper
|
|
|
|
---------
|
|
|
|
||/
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT regoperator('+(int4,int4)');
|
|
|
|
regoperator
|
|
|
|
--------------------
|
|
|
|
+(integer,integer)
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT regproc('now');
|
|
|
|
regproc
|
|
|
|
---------
|
|
|
|
now
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT regprocedure('abs(numeric)');
|
|
|
|
regprocedure
|
|
|
|
--------------
|
|
|
|
abs(numeric)
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT regclass('pg_class');
|
|
|
|
regclass
|
|
|
|
----------
|
|
|
|
pg_class
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT regtype('int4');
|
|
|
|
regtype
|
|
|
|
---------
|
|
|
|
integer
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regoper('||/');
|
|
|
|
to_regoper
|
|
|
|
------------
|
|
|
|
||/
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT to_regoperator('+(int4,int4)');
|
|
|
|
to_regoperator
|
|
|
|
--------------------
|
|
|
|
+(integer,integer)
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT to_regproc('now');
|
|
|
|
to_regproc
|
|
|
|
------------
|
|
|
|
now
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT to_regprocedure('abs(numeric)');
|
|
|
|
to_regprocedure
|
|
|
|
-----------------
|
|
|
|
abs(numeric)
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT to_regclass('pg_class');
|
|
|
|
to_regclass
|
|
|
|
-------------
|
|
|
|
pg_class
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regtype('int4');
|
|
|
|
to_regtype
|
|
|
|
------------
|
|
|
|
integer
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- with schemaname
|
|
|
|
SELECT regoper('pg_catalog.||/');
|
|
|
|
regoper
|
|
|
|
---------
|
|
|
|
||/
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT regoperator('pg_catalog.+(int4,int4)');
|
|
|
|
regoperator
|
|
|
|
--------------------
|
|
|
|
+(integer,integer)
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT regproc('pg_catalog.now');
|
|
|
|
regproc
|
|
|
|
---------
|
|
|
|
now
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT regprocedure('pg_catalog.abs(numeric)');
|
|
|
|
regprocedure
|
|
|
|
--------------
|
|
|
|
abs(numeric)
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT regclass('pg_catalog.pg_class');
|
|
|
|
regclass
|
|
|
|
----------
|
|
|
|
pg_class
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT regtype('pg_catalog.int4');
|
|
|
|
regtype
|
|
|
|
---------
|
|
|
|
integer
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regoper('pg_catalog.||/');
|
|
|
|
to_regoper
|
|
|
|
------------
|
|
|
|
||/
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regproc('pg_catalog.now');
|
|
|
|
to_regproc
|
|
|
|
------------
|
|
|
|
now
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT to_regprocedure('pg_catalog.abs(numeric)');
|
|
|
|
to_regprocedure
|
|
|
|
-----------------
|
|
|
|
abs(numeric)
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT to_regclass('pg_catalog.pg_class');
|
|
|
|
to_regclass
|
|
|
|
-------------
|
|
|
|
pg_class
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regtype('pg_catalog.int4');
|
|
|
|
to_regtype
|
|
|
|
------------
|
|
|
|
integer
|
|
|
|
(1 row)
|
|
|
|
|
2016-01-04 07:03:53 +01:00
|
|
|
-- schemaname not applicable
|
|
|
|
SELECT regrole('regtestrole');
|
|
|
|
regrole
|
|
|
|
-------------
|
|
|
|
regtestrole
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT regrole('"regtestrole"');
|
|
|
|
regrole
|
|
|
|
-------------
|
|
|
|
regtestrole
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT regnamespace('pg_catalog');
|
|
|
|
regnamespace
|
|
|
|
--------------
|
|
|
|
pg_catalog
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT regnamespace('"pg_catalog"');
|
|
|
|
regnamespace
|
|
|
|
--------------
|
|
|
|
pg_catalog
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regrole('regtestrole');
|
|
|
|
to_regrole
|
|
|
|
-------------
|
|
|
|
regtestrole
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regrole('"regtestrole"');
|
|
|
|
to_regrole
|
|
|
|
-------------
|
|
|
|
regtestrole
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regnamespace('pg_catalog');
|
|
|
|
to_regnamespace
|
|
|
|
-----------------
|
|
|
|
pg_catalog
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regnamespace('"pg_catalog"');
|
|
|
|
to_regnamespace
|
|
|
|
-----------------
|
|
|
|
pg_catalog
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
/* If objects don't exist, raise errors. */
|
2015-05-09 19:06:49 +02:00
|
|
|
DROP ROLE regtestrole;
|
2014-04-08 16:27:56 +02:00
|
|
|
-- without schemaname
|
|
|
|
SELECT regoper('||//');
|
|
|
|
ERROR: operator does not exist: ||//
|
2015-05-09 19:06:49 +02:00
|
|
|
LINE 1: SELECT regoper('||//');
|
2014-04-08 16:27:56 +02:00
|
|
|
^
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT regoperator('++(int4,int4)');
|
|
|
|
ERROR: operator does not exist: ++(int4,int4)
|
|
|
|
LINE 1: SELECT regoperator('++(int4,int4)');
|
|
|
|
^
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT regproc('know');
|
|
|
|
ERROR: function "know" does not exist
|
|
|
|
LINE 1: SELECT regproc('know');
|
|
|
|
^
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT regprocedure('absinthe(numeric)');
|
|
|
|
ERROR: function "absinthe(numeric)" does not exist
|
|
|
|
LINE 1: SELECT regprocedure('absinthe(numeric)');
|
|
|
|
^
|
2014-04-08 16:27:56 +02:00
|
|
|
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.||/');
|
|
|
|
^
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT regoperator('ng_catalog.+(int4,int4)');
|
|
|
|
ERROR: operator does not exist: ng_catalog.+(int4,int4)
|
|
|
|
LINE 1: SELECT regoperator('ng_catalog.+(int4,int4)');
|
|
|
|
^
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT regproc('ng_catalog.now');
|
|
|
|
ERROR: schema "ng_catalog" does not exist
|
|
|
|
LINE 1: SELECT regproc('ng_catalog.now');
|
|
|
|
^
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT regprocedure('ng_catalog.abs(numeric)');
|
|
|
|
ERROR: schema "ng_catalog" does not exist
|
|
|
|
LINE 1: SELECT regprocedure('ng_catalog.abs(numeric)');
|
|
|
|
^
|
2014-04-08 16:27:56 +02:00
|
|
|
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');
|
|
|
|
^
|
2016-01-04 07:03:53 +01:00
|
|
|
-- schemaname not applicable
|
|
|
|
SELECT regrole('regtestrole');
|
|
|
|
ERROR: role "regtestrole" does not exist
|
|
|
|
LINE 1: SELECT regrole('regtestrole');
|
|
|
|
^
|
|
|
|
SELECT regrole('"regtestrole"');
|
|
|
|
ERROR: role "regtestrole" does not exist
|
|
|
|
LINE 1: SELECT regrole('"regtestrole"');
|
|
|
|
^
|
|
|
|
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');
|
|
|
|
^
|
2014-04-08 16:27:56 +02:00
|
|
|
/* If objects don't exist, return NULL with no error. */
|
|
|
|
-- without schemaname
|
|
|
|
SELECT to_regoper('||//');
|
|
|
|
to_regoper
|
|
|
|
------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT to_regoperator('++(int4,int4)');
|
|
|
|
to_regoperator
|
|
|
|
----------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT to_regproc('know');
|
|
|
|
to_regproc
|
|
|
|
------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT to_regprocedure('absinthe(numeric)');
|
|
|
|
to_regprocedure
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT to_regclass('pg_classes');
|
|
|
|
to_regclass
|
|
|
|
-------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regtype('int3');
|
|
|
|
to_regtype
|
|
|
|
------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- with schemaname
|
|
|
|
SELECT to_regoper('ng_catalog.||/');
|
|
|
|
to_regoper
|
|
|
|
------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT to_regoperator('ng_catalog.+(int4,int4)');
|
|
|
|
to_regoperator
|
|
|
|
----------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT to_regproc('ng_catalog.now');
|
|
|
|
to_regproc
|
|
|
|
------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-16 18:21:43 +02:00
|
|
|
SELECT to_regprocedure('ng_catalog.abs(numeric)');
|
|
|
|
to_regprocedure
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2014-04-08 16:27:56 +02:00
|
|
|
SELECT to_regclass('ng_catalog.pg_class');
|
|
|
|
to_regclass
|
|
|
|
-------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regtype('ng_catalog.int4');
|
|
|
|
to_regtype
|
|
|
|
------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2016-01-04 07:03:53 +01:00
|
|
|
-- schemaname not applicable
|
|
|
|
SELECT to_regrole('regtestrole');
|
|
|
|
to_regrole
|
|
|
|
------------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT to_regrole('"regtestrole"');
|
|
|
|
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
|