Clean up SQL code indentation in test file

This makes the code layout more consistent inside the same file.
This commit is contained in:
Peter Eisentraut 2022-11-18 15:31:55 +01:00
parent 97ee956416
commit d0ca708540
2 changed files with 220 additions and 216 deletions

View File

@ -17,10 +17,11 @@ CREATE TEXT SEARCH TEMPLATE addr_ts_temp (lexize=dsimple_lexize);
CREATE TEXT SEARCH PARSER addr_ts_prs CREATE TEXT SEARCH PARSER addr_ts_prs
(start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype); (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
CREATE TABLE addr_nsp.gentable ( CREATE TABLE addr_nsp.gentable (
a serial primary key CONSTRAINT a_chk CHECK (a > 0), a serial primary key CONSTRAINT a_chk CHECK (a > 0),
b text DEFAULT 'hello'); b text DEFAULT 'hello'
);
CREATE TABLE addr_nsp.parttable ( CREATE TABLE addr_nsp.parttable (
a int PRIMARY KEY a int PRIMARY KEY
) PARTITION BY RANGE (a); ) PARTITION BY RANGE (a);
CREATE VIEW addr_nsp.genview AS SELECT * from addr_nsp.gentable; CREATE VIEW addr_nsp.genview AS SELECT * from addr_nsp.gentable;
CREATE MATERIALIZED VIEW addr_nsp.genmatview AS SELECT * FROM addr_nsp.gentable; CREATE MATERIALIZED VIEW addr_nsp.genmatview AS SELECT * FROM addr_nsp.gentable;
@ -40,8 +41,8 @@ ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM
-- this transform would be quite unsafe to leave lying around, -- this transform would be quite unsafe to leave lying around,
-- except that the SQL language pays no attention to transforms: -- except that the SQL language pays no attention to transforms:
CREATE TRANSFORM FOR int LANGUAGE SQL ( CREATE TRANSFORM FOR int LANGUAGE SQL (
FROM SQL WITH FUNCTION prsd_lextype(internal), FROM SQL WITH FUNCTION prsd_lextype(internal),
TO SQL WITH FUNCTION int4recv(internal)); TO SQL WITH FUNCTION int4recv(internal));
-- suppress warning that depends on wal_level -- suppress warning that depends on wal_level
SET client_min_messages = 'ERROR'; SET client_min_messages = 'ERROR';
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable; CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
@ -61,17 +62,17 @@ ERROR: name or argument lists may not contain nulls
-- unrecognized object types -- unrecognized object types
DO $$ DO $$
DECLARE DECLARE
objtype text; objtype text;
BEGIN BEGIN
FOR objtype IN VALUES ('toast table'), ('index column'), ('sequence column'), FOR objtype IN VALUES ('toast table'), ('index column'), ('sequence column'),
('toast table column'), ('view column'), ('materialized view column') ('toast table column'), ('view column'), ('materialized view column')
LOOP LOOP
BEGIN BEGIN
PERFORM pg_get_object_address(objtype, '{one}', '{}'); PERFORM pg_get_object_address(objtype, '{one}', '{}');
EXCEPTION WHEN invalid_parameter_value THEN EXCEPTION WHEN invalid_parameter_value THEN
RAISE WARNING 'error for %: %', objtype, sqlerrm; RAISE WARNING 'error for %: %', objtype, sqlerrm;
END; END;
END LOOP; END LOOP;
END; END;
$$; $$;
WARNING: error for toast table: unsupported object type "toast table" WARNING: error for toast table: unsupported object type "toast table"
@ -91,35 +92,35 @@ select * from pg_get_object_address('function of access method', '{btree,integer
ERROR: function 99 (int4, int4) of operator family integer_ops for access method btree does not exist ERROR: function 99 (int4, int4) of operator family integer_ops for access method btree does not exist
DO $$ DO $$
DECLARE DECLARE
objtype text; objtype text;
names text[]; names text[];
args text[]; args text[];
BEGIN BEGIN
FOR objtype IN VALUES FOR objtype IN VALUES
('table'), ('index'), ('sequence'), ('view'), ('table'), ('index'), ('sequence'), ('view'),
('materialized view'), ('foreign table'), ('materialized view'), ('foreign table'),
('table column'), ('foreign table column'), ('table column'), ('foreign table column'),
('aggregate'), ('function'), ('procedure'), ('type'), ('cast'), ('aggregate'), ('function'), ('procedure'), ('type'), ('cast'),
('table constraint'), ('domain constraint'), ('conversion'), ('default value'), ('table constraint'), ('domain constraint'), ('conversion'), ('default value'),
('operator'), ('operator class'), ('operator family'), ('rule'), ('trigger'), ('operator'), ('operator class'), ('operator family'), ('rule'), ('trigger'),
('text search parser'), ('text search dictionary'), ('text search parser'), ('text search dictionary'),
('text search template'), ('text search configuration'), ('text search template'), ('text search configuration'),
('policy'), ('user mapping'), ('default acl'), ('transform'), ('policy'), ('user mapping'), ('default acl'), ('transform'),
('operator of access method'), ('function of access method'), ('operator of access method'), ('function of access method'),
('publication namespace'), ('publication relation') ('publication namespace'), ('publication relation')
LOOP LOOP
FOR names IN VALUES ('{eins}'), ('{addr_nsp, zwei}'), ('{eins, zwei, drei}') FOR names IN VALUES ('{eins}'), ('{addr_nsp, zwei}'), ('{eins, zwei, drei}')
LOOP LOOP
FOR args IN VALUES ('{}'), ('{integer}') FOR args IN VALUES ('{}'), ('{integer}')
LOOP LOOP
BEGIN BEGIN
PERFORM pg_get_object_address(objtype, names, args); PERFORM pg_get_object_address(objtype, names, args);
EXCEPTION WHEN OTHERS THEN EXCEPTION WHEN OTHERS THEN
RAISE WARNING 'error for %,%,%: %', objtype, names, args, sqlerrm; RAISE WARNING 'error for %,%,%: %', objtype, names, args, sqlerrm;
END; END;
END LOOP; END LOOP;
END LOOP; END LOOP;
END LOOP; END LOOP;
END; END;
$$; $$;
WARNING: error for table,{eins},{}: relation "eins" does not exist WARNING: error for table,{eins},{}: relation "eins" does not exist
@ -383,73 +384,74 @@ SELECT pg_get_object_address('subscription', '{one,two}', '{}');
ERROR: name list length must be exactly 1 ERROR: name list length must be exactly 1
-- test successful cases -- test successful cases
WITH objects (type, name, args) AS (VALUES WITH objects (type, name, args) AS (VALUES
('table', '{addr_nsp, gentable}'::text[], '{}'::text[]), ('table', '{addr_nsp, gentable}'::text[], '{}'::text[]),
('table', '{addr_nsp, parttable}'::text[], '{}'::text[]), ('table', '{addr_nsp, parttable}'::text[], '{}'::text[]),
('index', '{addr_nsp, gentable_pkey}', '{}'), ('index', '{addr_nsp, gentable_pkey}', '{}'),
('index', '{addr_nsp, parttable_pkey}', '{}'), ('index', '{addr_nsp, parttable_pkey}', '{}'),
('sequence', '{addr_nsp, gentable_a_seq}', '{}'), ('sequence', '{addr_nsp, gentable_a_seq}', '{}'),
-- toast table -- toast table
('view', '{addr_nsp, genview}', '{}'), ('view', '{addr_nsp, genview}', '{}'),
('materialized view', '{addr_nsp, genmatview}', '{}'), ('materialized view', '{addr_nsp, genmatview}', '{}'),
('foreign table', '{addr_nsp, genftable}', '{}'), ('foreign table', '{addr_nsp, genftable}', '{}'),
('table column', '{addr_nsp, gentable, b}', '{}'), ('table column', '{addr_nsp, gentable, b}', '{}'),
('foreign table column', '{addr_nsp, genftable, a}', '{}'), ('foreign table column', '{addr_nsp, genftable, a}', '{}'),
('aggregate', '{addr_nsp, genaggr}', '{int4}'), ('aggregate', '{addr_nsp, genaggr}', '{int4}'),
('function', '{pg_catalog, pg_identify_object}', '{pg_catalog.oid, pg_catalog.oid, int4}'), ('function', '{pg_catalog, pg_identify_object}', '{pg_catalog.oid, pg_catalog.oid, int4}'),
('procedure', '{addr_nsp, proc}', '{int4}'), ('procedure', '{addr_nsp, proc}', '{int4}'),
('type', '{pg_catalog._int4}', '{}'), ('type', '{pg_catalog._int4}', '{}'),
('type', '{addr_nsp.gendomain}', '{}'), ('type', '{addr_nsp.gendomain}', '{}'),
('type', '{addr_nsp.gencomptype}', '{}'), ('type', '{addr_nsp.gencomptype}', '{}'),
('type', '{addr_nsp.genenum}', '{}'), ('type', '{addr_nsp.genenum}', '{}'),
('cast', '{int8}', '{int4}'), ('cast', '{int8}', '{int4}'),
('collation', '{default}', '{}'), ('collation', '{default}', '{}'),
('table constraint', '{addr_nsp, gentable, a_chk}', '{}'), ('table constraint', '{addr_nsp, gentable, a_chk}', '{}'),
('domain constraint', '{addr_nsp.gendomain}', '{domconstr}'), ('domain constraint', '{addr_nsp.gendomain}', '{domconstr}'),
('conversion', '{pg_catalog, koi8_r_to_mic}', '{}'), ('conversion', '{pg_catalog, koi8_r_to_mic}', '{}'),
('default value', '{addr_nsp, gentable, b}', '{}'), ('default value', '{addr_nsp, gentable, b}', '{}'),
('language', '{plpgsql}', '{}'), ('language', '{plpgsql}', '{}'),
-- large object -- large object
('operator', '{+}', '{int4, int4}'), ('operator', '{+}', '{int4, int4}'),
('operator class', '{btree, int4_ops}', '{}'), ('operator class', '{btree, int4_ops}', '{}'),
('operator family', '{btree, integer_ops}', '{}'), ('operator family', '{btree, integer_ops}', '{}'),
('operator of access method', '{btree,integer_ops,1}', '{integer,integer}'), ('operator of access method', '{btree,integer_ops,1}', '{integer,integer}'),
('function of access method', '{btree,integer_ops,2}', '{integer,integer}'), ('function of access method', '{btree,integer_ops,2}', '{integer,integer}'),
('rule', '{addr_nsp, genview, _RETURN}', '{}'), ('rule', '{addr_nsp, genview, _RETURN}', '{}'),
('trigger', '{addr_nsp, gentable, t}', '{}'), ('trigger', '{addr_nsp, gentable, t}', '{}'),
('schema', '{addr_nsp}', '{}'), ('schema', '{addr_nsp}', '{}'),
('text search parser', '{addr_ts_prs}', '{}'), ('text search parser', '{addr_ts_prs}', '{}'),
('text search dictionary', '{addr_ts_dict}', '{}'), ('text search dictionary', '{addr_ts_dict}', '{}'),
('text search template', '{addr_ts_temp}', '{}'), ('text search template', '{addr_ts_temp}', '{}'),
('text search configuration', '{addr_ts_conf}', '{}'), ('text search configuration', '{addr_ts_conf}', '{}'),
('role', '{regress_addr_user}', '{}'), ('role', '{regress_addr_user}', '{}'),
-- database -- database
-- tablespace -- tablespace
('foreign-data wrapper', '{addr_fdw}', '{}'), ('foreign-data wrapper', '{addr_fdw}', '{}'),
('server', '{addr_fserv}', '{}'), ('server', '{addr_fserv}', '{}'),
('user mapping', '{regress_addr_user}', '{integer}'), ('user mapping', '{regress_addr_user}', '{integer}'),
('default acl', '{regress_addr_user,public}', '{r}'), ('default acl', '{regress_addr_user,public}', '{r}'),
('default acl', '{regress_addr_user}', '{r}'), ('default acl', '{regress_addr_user}', '{r}'),
-- extension -- extension
-- event trigger -- event trigger
('policy', '{addr_nsp, gentable, genpol}', '{}'), ('policy', '{addr_nsp, gentable, genpol}', '{}'),
('transform', '{int}', '{sql}'), ('transform', '{int}', '{sql}'),
('access method', '{btree}', '{}'), ('access method', '{btree}', '{}'),
('publication', '{addr_pub}', '{}'), ('publication', '{addr_pub}', '{}'),
('publication namespace', '{addr_nsp}', '{addr_pub_schema}'), ('publication namespace', '{addr_nsp}', '{addr_pub_schema}'),
('publication relation', '{addr_nsp, gentable}', '{addr_pub}'), ('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
('subscription', '{regress_addr_sub}', '{}'), ('subscription', '{regress_addr_sub}', '{}'),
('statistics object', '{addr_nsp, gentable_stat}', '{}') ('statistics object', '{addr_nsp, gentable_stat}', '{}')
) )
SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*, SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
-- test roundtrip through pg_identify_object_as_address -- test roundtrip through pg_identify_object_as_address
ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)) = ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)) =
ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.objsubid)) ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.objsubid)) AS roundtrip
FROM objects, pg_get_object_address(type, name, args) addr1, FROM objects,
pg_identify_object_as_address(classid, objid, objsubid) ioa(typ,nms,args), pg_get_object_address(type, name, args) AS addr1,
pg_get_object_address(typ, nms, ioa.args) as addr2 pg_identify_object_as_address(classid, objid, objsubid) AS ioa (typ, nms, args),
ORDER BY addr1.classid, addr1.objid, addr1.objsubid; pg_get_object_address(typ, nms, ioa.args) AS addr2
type | schema | name | identity | ?column? ORDER BY addr1.classid, addr1.objid, addr1.objsubid;
---------------------------+------------+-------------------+----------------------------------------------------------------------+---------- type | schema | name | identity | roundtrip
---------------------------+------------+-------------------+----------------------------------------------------------------------+-----------
default acl | | | for role regress_addr_user in schema public on tables | t default acl | | | for role regress_addr_user in schema public on tables | t
default acl | | | for role regress_addr_user on tables | t default acl | | | for role regress_addr_user on tables | t
type | pg_catalog | _int4 | integer[] | t type | pg_catalog | _int4 | integer[] | t

View File

@ -20,10 +20,11 @@ CREATE TEXT SEARCH TEMPLATE addr_ts_temp (lexize=dsimple_lexize);
CREATE TEXT SEARCH PARSER addr_ts_prs CREATE TEXT SEARCH PARSER addr_ts_prs
(start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype); (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
CREATE TABLE addr_nsp.gentable ( CREATE TABLE addr_nsp.gentable (
a serial primary key CONSTRAINT a_chk CHECK (a > 0), a serial primary key CONSTRAINT a_chk CHECK (a > 0),
b text DEFAULT 'hello'); b text DEFAULT 'hello'
);
CREATE TABLE addr_nsp.parttable ( CREATE TABLE addr_nsp.parttable (
a int PRIMARY KEY a int PRIMARY KEY
) PARTITION BY RANGE (a); ) PARTITION BY RANGE (a);
CREATE VIEW addr_nsp.genview AS SELECT * from addr_nsp.gentable; CREATE VIEW addr_nsp.genview AS SELECT * from addr_nsp.gentable;
CREATE MATERIALIZED VIEW addr_nsp.genmatview AS SELECT * FROM addr_nsp.gentable; CREATE MATERIALIZED VIEW addr_nsp.genmatview AS SELECT * FROM addr_nsp.gentable;
@ -43,8 +44,8 @@ ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM
-- this transform would be quite unsafe to leave lying around, -- this transform would be quite unsafe to leave lying around,
-- except that the SQL language pays no attention to transforms: -- except that the SQL language pays no attention to transforms:
CREATE TRANSFORM FOR int LANGUAGE SQL ( CREATE TRANSFORM FOR int LANGUAGE SQL (
FROM SQL WITH FUNCTION prsd_lextype(internal), FROM SQL WITH FUNCTION prsd_lextype(internal),
TO SQL WITH FUNCTION int4recv(internal)); TO SQL WITH FUNCTION int4recv(internal));
-- suppress warning that depends on wal_level -- suppress warning that depends on wal_level
SET client_min_messages = 'ERROR'; SET client_min_messages = 'ERROR';
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable; CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
@ -61,17 +62,17 @@ SELECT pg_get_object_address('table', '{NULL}', '{}');
-- unrecognized object types -- unrecognized object types
DO $$ DO $$
DECLARE DECLARE
objtype text; objtype text;
BEGIN BEGIN
FOR objtype IN VALUES ('toast table'), ('index column'), ('sequence column'), FOR objtype IN VALUES ('toast table'), ('index column'), ('sequence column'),
('toast table column'), ('view column'), ('materialized view column') ('toast table column'), ('view column'), ('materialized view column')
LOOP LOOP
BEGIN BEGIN
PERFORM pg_get_object_address(objtype, '{one}', '{}'); PERFORM pg_get_object_address(objtype, '{one}', '{}');
EXCEPTION WHEN invalid_parameter_value THEN EXCEPTION WHEN invalid_parameter_value THEN
RAISE WARNING 'error for %: %', objtype, sqlerrm; RAISE WARNING 'error for %: %', objtype, sqlerrm;
END; END;
END LOOP; END LOOP;
END; END;
$$; $$;
@ -83,35 +84,35 @@ select * from pg_get_object_address('function of access method', '{btree,integer
DO $$ DO $$
DECLARE DECLARE
objtype text; objtype text;
names text[]; names text[];
args text[]; args text[];
BEGIN BEGIN
FOR objtype IN VALUES FOR objtype IN VALUES
('table'), ('index'), ('sequence'), ('view'), ('table'), ('index'), ('sequence'), ('view'),
('materialized view'), ('foreign table'), ('materialized view'), ('foreign table'),
('table column'), ('foreign table column'), ('table column'), ('foreign table column'),
('aggregate'), ('function'), ('procedure'), ('type'), ('cast'), ('aggregate'), ('function'), ('procedure'), ('type'), ('cast'),
('table constraint'), ('domain constraint'), ('conversion'), ('default value'), ('table constraint'), ('domain constraint'), ('conversion'), ('default value'),
('operator'), ('operator class'), ('operator family'), ('rule'), ('trigger'), ('operator'), ('operator class'), ('operator family'), ('rule'), ('trigger'),
('text search parser'), ('text search dictionary'), ('text search parser'), ('text search dictionary'),
('text search template'), ('text search configuration'), ('text search template'), ('text search configuration'),
('policy'), ('user mapping'), ('default acl'), ('transform'), ('policy'), ('user mapping'), ('default acl'), ('transform'),
('operator of access method'), ('function of access method'), ('operator of access method'), ('function of access method'),
('publication namespace'), ('publication relation') ('publication namespace'), ('publication relation')
LOOP LOOP
FOR names IN VALUES ('{eins}'), ('{addr_nsp, zwei}'), ('{eins, zwei, drei}') FOR names IN VALUES ('{eins}'), ('{addr_nsp, zwei}'), ('{eins, zwei, drei}')
LOOP LOOP
FOR args IN VALUES ('{}'), ('{integer}') FOR args IN VALUES ('{}'), ('{integer}')
LOOP LOOP
BEGIN BEGIN
PERFORM pg_get_object_address(objtype, names, args); PERFORM pg_get_object_address(objtype, names, args);
EXCEPTION WHEN OTHERS THEN EXCEPTION WHEN OTHERS THEN
RAISE WARNING 'error for %,%,%: %', objtype, names, args, sqlerrm; RAISE WARNING 'error for %,%,%: %', objtype, names, args, sqlerrm;
END; END;
END LOOP; END LOOP;
END LOOP; END LOOP;
END LOOP; END LOOP;
END; END;
$$; $$;
@ -146,71 +147,72 @@ SELECT pg_get_object_address('subscription', '{one,two}', '{}');
-- test successful cases -- test successful cases
WITH objects (type, name, args) AS (VALUES WITH objects (type, name, args) AS (VALUES
('table', '{addr_nsp, gentable}'::text[], '{}'::text[]), ('table', '{addr_nsp, gentable}'::text[], '{}'::text[]),
('table', '{addr_nsp, parttable}'::text[], '{}'::text[]), ('table', '{addr_nsp, parttable}'::text[], '{}'::text[]),
('index', '{addr_nsp, gentable_pkey}', '{}'), ('index', '{addr_nsp, gentable_pkey}', '{}'),
('index', '{addr_nsp, parttable_pkey}', '{}'), ('index', '{addr_nsp, parttable_pkey}', '{}'),
('sequence', '{addr_nsp, gentable_a_seq}', '{}'), ('sequence', '{addr_nsp, gentable_a_seq}', '{}'),
-- toast table -- toast table
('view', '{addr_nsp, genview}', '{}'), ('view', '{addr_nsp, genview}', '{}'),
('materialized view', '{addr_nsp, genmatview}', '{}'), ('materialized view', '{addr_nsp, genmatview}', '{}'),
('foreign table', '{addr_nsp, genftable}', '{}'), ('foreign table', '{addr_nsp, genftable}', '{}'),
('table column', '{addr_nsp, gentable, b}', '{}'), ('table column', '{addr_nsp, gentable, b}', '{}'),
('foreign table column', '{addr_nsp, genftable, a}', '{}'), ('foreign table column', '{addr_nsp, genftable, a}', '{}'),
('aggregate', '{addr_nsp, genaggr}', '{int4}'), ('aggregate', '{addr_nsp, genaggr}', '{int4}'),
('function', '{pg_catalog, pg_identify_object}', '{pg_catalog.oid, pg_catalog.oid, int4}'), ('function', '{pg_catalog, pg_identify_object}', '{pg_catalog.oid, pg_catalog.oid, int4}'),
('procedure', '{addr_nsp, proc}', '{int4}'), ('procedure', '{addr_nsp, proc}', '{int4}'),
('type', '{pg_catalog._int4}', '{}'), ('type', '{pg_catalog._int4}', '{}'),
('type', '{addr_nsp.gendomain}', '{}'), ('type', '{addr_nsp.gendomain}', '{}'),
('type', '{addr_nsp.gencomptype}', '{}'), ('type', '{addr_nsp.gencomptype}', '{}'),
('type', '{addr_nsp.genenum}', '{}'), ('type', '{addr_nsp.genenum}', '{}'),
('cast', '{int8}', '{int4}'), ('cast', '{int8}', '{int4}'),
('collation', '{default}', '{}'), ('collation', '{default}', '{}'),
('table constraint', '{addr_nsp, gentable, a_chk}', '{}'), ('table constraint', '{addr_nsp, gentable, a_chk}', '{}'),
('domain constraint', '{addr_nsp.gendomain}', '{domconstr}'), ('domain constraint', '{addr_nsp.gendomain}', '{domconstr}'),
('conversion', '{pg_catalog, koi8_r_to_mic}', '{}'), ('conversion', '{pg_catalog, koi8_r_to_mic}', '{}'),
('default value', '{addr_nsp, gentable, b}', '{}'), ('default value', '{addr_nsp, gentable, b}', '{}'),
('language', '{plpgsql}', '{}'), ('language', '{plpgsql}', '{}'),
-- large object -- large object
('operator', '{+}', '{int4, int4}'), ('operator', '{+}', '{int4, int4}'),
('operator class', '{btree, int4_ops}', '{}'), ('operator class', '{btree, int4_ops}', '{}'),
('operator family', '{btree, integer_ops}', '{}'), ('operator family', '{btree, integer_ops}', '{}'),
('operator of access method', '{btree,integer_ops,1}', '{integer,integer}'), ('operator of access method', '{btree,integer_ops,1}', '{integer,integer}'),
('function of access method', '{btree,integer_ops,2}', '{integer,integer}'), ('function of access method', '{btree,integer_ops,2}', '{integer,integer}'),
('rule', '{addr_nsp, genview, _RETURN}', '{}'), ('rule', '{addr_nsp, genview, _RETURN}', '{}'),
('trigger', '{addr_nsp, gentable, t}', '{}'), ('trigger', '{addr_nsp, gentable, t}', '{}'),
('schema', '{addr_nsp}', '{}'), ('schema', '{addr_nsp}', '{}'),
('text search parser', '{addr_ts_prs}', '{}'), ('text search parser', '{addr_ts_prs}', '{}'),
('text search dictionary', '{addr_ts_dict}', '{}'), ('text search dictionary', '{addr_ts_dict}', '{}'),
('text search template', '{addr_ts_temp}', '{}'), ('text search template', '{addr_ts_temp}', '{}'),
('text search configuration', '{addr_ts_conf}', '{}'), ('text search configuration', '{addr_ts_conf}', '{}'),
('role', '{regress_addr_user}', '{}'), ('role', '{regress_addr_user}', '{}'),
-- database -- database
-- tablespace -- tablespace
('foreign-data wrapper', '{addr_fdw}', '{}'), ('foreign-data wrapper', '{addr_fdw}', '{}'),
('server', '{addr_fserv}', '{}'), ('server', '{addr_fserv}', '{}'),
('user mapping', '{regress_addr_user}', '{integer}'), ('user mapping', '{regress_addr_user}', '{integer}'),
('default acl', '{regress_addr_user,public}', '{r}'), ('default acl', '{regress_addr_user,public}', '{r}'),
('default acl', '{regress_addr_user}', '{r}'), ('default acl', '{regress_addr_user}', '{r}'),
-- extension -- extension
-- event trigger -- event trigger
('policy', '{addr_nsp, gentable, genpol}', '{}'), ('policy', '{addr_nsp, gentable, genpol}', '{}'),
('transform', '{int}', '{sql}'), ('transform', '{int}', '{sql}'),
('access method', '{btree}', '{}'), ('access method', '{btree}', '{}'),
('publication', '{addr_pub}', '{}'), ('publication', '{addr_pub}', '{}'),
('publication namespace', '{addr_nsp}', '{addr_pub_schema}'), ('publication namespace', '{addr_nsp}', '{addr_pub_schema}'),
('publication relation', '{addr_nsp, gentable}', '{addr_pub}'), ('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
('subscription', '{regress_addr_sub}', '{}'), ('subscription', '{regress_addr_sub}', '{}'),
('statistics object', '{addr_nsp, gentable_stat}', '{}') ('statistics object', '{addr_nsp, gentable_stat}', '{}')
) )
SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*, SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
-- test roundtrip through pg_identify_object_as_address -- test roundtrip through pg_identify_object_as_address
ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)) = ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)) =
ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.objsubid)) ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.objsubid)) AS roundtrip
FROM objects, pg_get_object_address(type, name, args) addr1, FROM objects,
pg_identify_object_as_address(classid, objid, objsubid) ioa(typ,nms,args), pg_get_object_address(type, name, args) AS addr1,
pg_get_object_address(typ, nms, ioa.args) as addr2 pg_identify_object_as_address(classid, objid, objsubid) AS ioa (typ, nms, args),
ORDER BY addr1.classid, addr1.objid, addr1.objsubid; pg_get_object_address(typ, nms, ioa.args) AS addr2
ORDER BY addr1.classid, addr1.objid, addr1.objsubid;
--- ---
--- Cleanup resources --- Cleanup resources