1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Add new OID alias type regrole

The new type has the scope of whole the database cluster so it doesn't
behave the same as the existing OID alias types which have database
scope,
concerning object dependency. To avoid confusion constants of the new
type are prohibited from appearing where dependencies are made involving
it.

Also, add a note to the docs about possible MVCC violation and
optimization issues, which are general over the all reg* types.

Kyotaro Horiguchi
This commit is contained in:
Andrew Dunstan
2015-05-09 13:06:49 -04:00
parent 0cf56f14dd
commit 0c90f6769d
20 changed files with 235 additions and 31 deletions

View File

@ -2,6 +2,7 @@
-- regproc
--
/* If objects exist, return oids */
CREATE ROLE regtestrole;
-- without schemaname
SELECT regoper('||/');
regoper
@ -39,6 +40,12 @@ SELECT regtype('int4');
integer
(1 row)
SELECT regrole('regtestrole');
regrole
-------------
regtestrole
(1 row)
SELECT to_regoper('||/');
to_regoper
------------
@ -75,6 +82,12 @@ SELECT to_regtype('int4');
integer
(1 row)
SELECT to_regrole('regtestrole');
to_regrole
-------------
regtestrole
(1 row)
-- with schemaname
SELECT regoper('pg_catalog.||/');
regoper
@ -143,10 +156,11 @@ SELECT to_regtype('pg_catalog.int4');
(1 row)
/* If objects don't exist, raise errors. */
DROP ROLE regtestrole;
-- without schemaname
SELECT regoper('||//');
ERROR: operator does not exist: ||//
LINE 3: SELECT regoper('||//');
LINE 1: SELECT regoper('||//');
^
SELECT regoperator('++(int4,int4)');
ERROR: operator does not exist: ++(int4,int4)
@ -168,6 +182,10 @@ SELECT regtype('int3');
ERROR: type "int3" does not exist
LINE 1: SELECT regtype('int3');
^
SELECT regrole('regtestrole');
ERROR: role "regtestrole" does not exist
LINE 1: SELECT regrole('regtestrole');
^
-- with schemaname
SELECT regoper('ng_catalog.||/');
ERROR: schema "ng_catalog" does not exist
@ -231,6 +249,12 @@ SELECT to_regtype('int3');
(1 row)
SELECT to_regrole('regtestrole');
to_regrole
------------
(1 row)
-- with schemaname
SELECT to_regoper('ng_catalog.||/');
to_regoper

View File

@ -4,6 +4,7 @@
/* If objects exist, return oids */
CREATE ROLE regtestrole;
-- without schemaname
SELECT regoper('||/');
@ -12,6 +13,7 @@ SELECT regproc('now');
SELECT regprocedure('abs(numeric)');
SELECT regclass('pg_class');
SELECT regtype('int4');
SELECT regrole('regtestrole');
SELECT to_regoper('||/');
SELECT to_regoperator('+(int4,int4)');
@ -19,6 +21,7 @@ SELECT to_regproc('now');
SELECT to_regprocedure('abs(numeric)');
SELECT to_regclass('pg_class');
SELECT to_regtype('int4');
SELECT to_regrole('regtestrole');
-- with schemaname
@ -37,6 +40,8 @@ SELECT to_regtype('pg_catalog.int4');
/* If objects don't exist, raise errors. */
DROP ROLE regtestrole;
-- without schemaname
SELECT regoper('||//');
@ -45,6 +50,7 @@ SELECT regproc('know');
SELECT regprocedure('absinthe(numeric)');
SELECT regclass('pg_classes');
SELECT regtype('int3');
SELECT regrole('regtestrole');
-- with schemaname
@ -65,6 +71,7 @@ SELECT to_regproc('know');
SELECT to_regprocedure('absinthe(numeric)');
SELECT to_regclass('pg_classes');
SELECT to_regtype('int3');
SELECT to_regrole('regtestrole');
-- with schemaname