1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-27 22:56:53 +03:00

Make object_address test output easier to update

The object_address test file turns to psql unaligned output for some
tests to avoid huge diffs for changes.  But this is useful also to the
other large test in that file, so apply it there as well.  This also
makes verifying the null and whitespace behavior easier.
This commit is contained in:
Peter Eisentraut 2022-11-18 16:00:52 +01:00
parent d0ca708540
commit d8678aba2e
2 changed files with 62 additions and 64 deletions

View File

@ -382,6 +382,11 @@ SELECT pg_get_object_address('subscription', '{one}', '{}');
ERROR: subscription "one" does not exist ERROR: subscription "one" does not exist
SELECT pg_get_object_address('subscription', '{one,two}', '{}'); SELECT pg_get_object_address('subscription', '{one,two}', '{}');
ERROR: name list length must be exactly 1 ERROR: name list length must be exactly 1
-- Make sure that NULL handling is correct.
\pset null 'NULL'
-- Temporarily disable fancy output, so as future additions never create
-- a large amount of diffs.
\a\t
-- 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[]),
@ -450,60 +455,56 @@ FROM objects,
pg_identify_object_as_address(classid, objid, objsubid) AS ioa (typ, nms, args), pg_identify_object_as_address(classid, objid, objsubid) AS ioa (typ, nms, args),
pg_get_object_address(typ, nms, ioa.args) AS addr2 pg_get_object_address(typ, nms, ioa.args) AS addr2
ORDER BY addr1.classid, addr1.objid, addr1.objsubid; ORDER BY addr1.classid, addr1.objid, addr1.objsubid;
type | schema | name | identity | roundtrip default acl|NULL|NULL|for role regress_addr_user in schema public on tables|t
---------------------------+------------+-------------------+----------------------------------------------------------------------+----------- default acl|NULL|NULL|for role regress_addr_user on tables|t
default acl | | | for role regress_addr_user in schema public on tables | t type|pg_catalog|_int4|integer[]|t
default acl | | | for role regress_addr_user on tables | t type|addr_nsp|gencomptype|addr_nsp.gencomptype|t
type | pg_catalog | _int4 | integer[] | t type|addr_nsp|genenum|addr_nsp.genenum|t
type | addr_nsp | gencomptype | addr_nsp.gencomptype | t type|addr_nsp|gendomain|addr_nsp.gendomain|t
type | addr_nsp | genenum | addr_nsp.genenum | t function|pg_catalog|NULL|pg_catalog.pg_identify_object(pg_catalog.oid,pg_catalog.oid,integer)|t
type | addr_nsp | gendomain | addr_nsp.gendomain | t aggregate|addr_nsp|NULL|addr_nsp.genaggr(integer)|t
function | pg_catalog | | pg_catalog.pg_identify_object(pg_catalog.oid,pg_catalog.oid,integer) | t procedure|addr_nsp|NULL|addr_nsp.proc(integer)|t
aggregate | addr_nsp | | addr_nsp.genaggr(integer) | t sequence|addr_nsp|gentable_a_seq|addr_nsp.gentable_a_seq|t
procedure | addr_nsp | | addr_nsp.proc(integer) | t table|addr_nsp|gentable|addr_nsp.gentable|t
sequence | addr_nsp | gentable_a_seq | addr_nsp.gentable_a_seq | t table column|addr_nsp|gentable|addr_nsp.gentable.b|t
table | addr_nsp | gentable | addr_nsp.gentable | t index|addr_nsp|gentable_pkey|addr_nsp.gentable_pkey|t
table column | addr_nsp | gentable | addr_nsp.gentable.b | t table|addr_nsp|parttable|addr_nsp.parttable|t
index | addr_nsp | gentable_pkey | addr_nsp.gentable_pkey | t index|addr_nsp|parttable_pkey|addr_nsp.parttable_pkey|t
table | addr_nsp | parttable | addr_nsp.parttable | t view|addr_nsp|genview|addr_nsp.genview|t
index | addr_nsp | parttable_pkey | addr_nsp.parttable_pkey | t materialized view|addr_nsp|genmatview|addr_nsp.genmatview|t
view | addr_nsp | genview | addr_nsp.genview | t foreign table|addr_nsp|genftable|addr_nsp.genftable|t
materialized view | addr_nsp | genmatview | addr_nsp.genmatview | t foreign table column|addr_nsp|genftable|addr_nsp.genftable.a|t
foreign table | addr_nsp | genftable | addr_nsp.genftable | t role|NULL|regress_addr_user|regress_addr_user|t
foreign table column | addr_nsp | genftable | addr_nsp.genftable.a | t server|NULL|addr_fserv|addr_fserv|t
role | | regress_addr_user | regress_addr_user | t user mapping|NULL|NULL|regress_addr_user on server integer|t
server | | addr_fserv | addr_fserv | t foreign-data wrapper|NULL|addr_fdw|addr_fdw|t
user mapping | | | regress_addr_user on server integer | t access method|NULL|btree|btree|t
foreign-data wrapper | | addr_fdw | addr_fdw | t operator of access method|NULL|NULL|operator 1 (integer, integer) of pg_catalog.integer_ops USING btree|t
access method | | btree | btree | t function of access method|NULL|NULL|function 2 (integer, integer) of pg_catalog.integer_ops USING btree|t
operator of access method | | | operator 1 (integer, integer) of pg_catalog.integer_ops USING btree | t default value|NULL|NULL|for addr_nsp.gentable.b|t
function of access method | | | function 2 (integer, integer) of pg_catalog.integer_ops USING btree | t cast|NULL|NULL|(bigint AS integer)|t
default value | | | for addr_nsp.gentable.b | t table constraint|addr_nsp|NULL|a_chk on addr_nsp.gentable|t
cast | | | (bigint AS integer) | t domain constraint|addr_nsp|NULL|domconstr on addr_nsp.gendomain|t
table constraint | addr_nsp | | a_chk on addr_nsp.gentable | t conversion|pg_catalog|koi8_r_to_mic|pg_catalog.koi8_r_to_mic|t
domain constraint | addr_nsp | | domconstr on addr_nsp.gendomain | t language|NULL|plpgsql|plpgsql|t
conversion | pg_catalog | koi8_r_to_mic | pg_catalog.koi8_r_to_mic | t schema|NULL|addr_nsp|addr_nsp|t
language | | plpgsql | plpgsql | t operator class|pg_catalog|int4_ops|pg_catalog.int4_ops USING btree|t
schema | | addr_nsp | addr_nsp | t operator|pg_catalog|NULL|pg_catalog.+(integer,integer)|t
operator class | pg_catalog | int4_ops | pg_catalog.int4_ops USING btree | t rule|NULL|NULL|"_RETURN" on addr_nsp.genview|t
operator | pg_catalog | | pg_catalog.+(integer,integer) | t trigger|NULL|NULL|t on addr_nsp.gentable|t
rule | | | "_RETURN" on addr_nsp.genview | t operator family|pg_catalog|integer_ops|pg_catalog.integer_ops USING btree|t
trigger | | | t on addr_nsp.gentable | t policy|NULL|NULL|genpol on addr_nsp.gentable|t
operator family | pg_catalog | integer_ops | pg_catalog.integer_ops USING btree | t statistics object|addr_nsp|gentable_stat|addr_nsp.gentable_stat|t
policy | | | genpol on addr_nsp.gentable | t collation|pg_catalog|"default"|pg_catalog."default"|t
statistics object | addr_nsp | gentable_stat | addr_nsp.gentable_stat | t transform|NULL|NULL|for integer on language sql|t
collation | pg_catalog | "default" | pg_catalog."default" | t text search dictionary|addr_nsp|addr_ts_dict|addr_nsp.addr_ts_dict|t
transform | | | for integer on language sql | t text search parser|addr_nsp|addr_ts_prs|addr_nsp.addr_ts_prs|t
text search dictionary | addr_nsp | addr_ts_dict | addr_nsp.addr_ts_dict | t text search configuration|addr_nsp|addr_ts_conf|addr_nsp.addr_ts_conf|t
text search parser | addr_nsp | addr_ts_prs | addr_nsp.addr_ts_prs | t text search template|addr_nsp|addr_ts_temp|addr_nsp.addr_ts_temp|t
text search configuration | addr_nsp | addr_ts_conf | addr_nsp.addr_ts_conf | t subscription|NULL|regress_addr_sub|regress_addr_sub|t
text search template | addr_nsp | addr_ts_temp | addr_nsp.addr_ts_temp | t publication|NULL|addr_pub|addr_pub|t
subscription | | regress_addr_sub | regress_addr_sub | t publication relation|NULL|NULL|addr_nsp.gentable in publication addr_pub|t
publication | | addr_pub | addr_pub | t publication namespace|NULL|NULL|addr_nsp in publication addr_pub_schema|t
publication relation | | | addr_nsp.gentable in publication addr_pub | t
publication namespace | | | addr_nsp in publication addr_pub_schema | t
(50 rows)
--- ---
--- Cleanup resources --- Cleanup resources
--- ---
@ -537,11 +538,6 @@ DROP USER regress_addr_user;
-- --
-- Checks for invalid objects -- Checks for invalid objects
-- --
-- Make sure that NULL handling is correct.
\pset null 'NULL'
-- Temporarily disable fancy output, so as future additions never create
-- a large amount of diffs.
\a\t
-- Keep this list in the same order as getObjectIdentityParts() -- Keep this list in the same order as getObjectIdentityParts()
-- in objectaddress.c. -- in objectaddress.c.
WITH objects (classid, objid, objsubid) AS (VALUES WITH objects (classid, objid, objsubid) AS (VALUES

View File

@ -145,6 +145,13 @@ SELECT pg_get_object_address('publication', '{one,two}', '{}');
SELECT pg_get_object_address('subscription', '{one}', '{}'); SELECT pg_get_object_address('subscription', '{one}', '{}');
SELECT pg_get_object_address('subscription', '{one,two}', '{}'); SELECT pg_get_object_address('subscription', '{one,two}', '{}');
-- Make sure that NULL handling is correct.
\pset null 'NULL'
-- Temporarily disable fancy output, so as future additions never create
-- a large amount of diffs.
\a\t
-- 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[]),
@ -230,11 +237,6 @@ DROP USER regress_addr_user;
-- --
-- Checks for invalid objects -- Checks for invalid objects
-- --
-- Make sure that NULL handling is correct.
\pset null 'NULL'
-- Temporarily disable fancy output, so as future additions never create
-- a large amount of diffs.
\a\t
-- Keep this list in the same order as getObjectIdentityParts() -- Keep this list in the same order as getObjectIdentityParts()
-- in objectaddress.c. -- in objectaddress.c.