Tweak regression test of pg_walinspect to be less collation-sensitive
authorMichael Paquier <michael@paquier.xyz>
Thu, 16 Mar 2023 04:24:12 +0000 (13:24 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 16 Mar 2023 04:24:12 +0000 (13:24 +0900)
\dx was used on pg_walinspect to list its objects in 1.0 but the names
of the objects in this version do not have an order that is always
guaranteed depending on the collation used.  Rather than append a
COLLATE clause in the query of \dx, this tweaks the regression test to
produce an output whose order is guaranteed.

Reported-by: Andres Freund
Author: Bharath Rupireddy
Discussion: https://postgr.es/m/20230314215440.gma7g4keswdnldj5@awork3.anarazel.de

contrib/pg_walinspect/expected/oldextversions.out
contrib/pg_walinspect/sql/oldextversions.sql

index 7949555c847203b2509feb91838b605ac270535a..da18914d92260b6695eb7b66085ede2193ba2cd6 100644 (file)
@@ -2,10 +2,14 @@
 CREATE EXTENSION pg_walinspect WITH VERSION '1.0';
 -- Mask DETAIL messages as these could refer to current LSN positions.
 \set VERBOSITY terse
--- List what version 1.0 contains
-\dx+ pg_walinspect
-           Objects in extension "pg_walinspect"
-                    Object description                     
+-- List what version 1.0 contains, using a locale-independent sorting.
+SELECT pg_describe_object(classid, objid, 0) AS obj
+  FROM pg_depend
+  WHERE refclassid = 'pg_extension'::regclass AND
+    refobjid = (SELECT oid FROM pg_extension
+                  WHERE extname = 'pg_walinspect') AND deptype = 'e'
+  ORDER BY pg_describe_object(classid, objid, 0) COLLATE "C";
+                            obj                            
 -----------------------------------------------------------
  function pg_get_wal_record_info(pg_lsn)
  function pg_get_wal_records_info(pg_lsn,pg_lsn)
index 258a0098883927e3f9ffe37f96b7a91261759ab3..1f8307816ef03ba7403714e39f5f924481cf6dde 100644 (file)
@@ -5,8 +5,13 @@ CREATE EXTENSION pg_walinspect WITH VERSION '1.0';
 -- Mask DETAIL messages as these could refer to current LSN positions.
 \set VERBOSITY terse
 
--- List what version 1.0 contains
-\dx+ pg_walinspect
+-- List what version 1.0 contains, using a locale-independent sorting.
+SELECT pg_describe_object(classid, objid, 0) AS obj
+  FROM pg_depend
+  WHERE refclassid = 'pg_extension'::regclass AND
+    refobjid = (SELECT oid FROM pg_extension
+                  WHERE extname = 'pg_walinspect') AND deptype = 'e'
+  ORDER BY pg_describe_object(classid, objid, 0) COLLATE "C";
 
 -- Make sure checkpoints don't interfere with the test.
 SELECT 'init' FROM pg_create_physical_replication_slot('regress_pg_walinspect_slot', true, false);