Fix compare-db-settings to work with Azure
authorUbuntu <kop@karlpinc.com>
Fri, 15 Sep 2023 21:08:51 +0000 (21:08 +0000)
committerUbuntu <kop@karlpinc.com>
Fri, 15 Sep 2023 21:08:51 +0000 (21:08 +0000)
For some reason on Azure's Postgres flexible-server PGv15 the
SQL

SELECT name, setting, unit, pending_restart \
                     FROM pg_settings \
                     ORDER BY name;

Does not return a consistent ordering when run on different databases
on the same PG server.  So run the output through `sort`.

make_files/make_db.mk

index 07d06a46d0a3fb45e8198d7705e72b84629eb6fa..88269801509dc0b96efe39318174efaf5b9507bd 100644 (file)
@@ -704,6 +704,7 @@ drop-public-root:
 db/pg_settings.new:
        printf '$(GET_PG_SETTINGS)\n' \
          | psql $(PSQL_ARGS_MINIMAL) --tuples-only \
+         | sort --stable \
          > db/pg_settings.new
 
 ##   compare-db-settings
@@ -715,7 +716,8 @@ db/pg_settings.new:
 compare-db-settings:
        printf '$(GET_PG_SETTINGS)\n' \
          | psql $(PSQL_ARGS_MINIMAL) --tuples-only \
-         | diff -u db/pg_settings /dev/stdin
+         | sort --stable \
+         | diff -U 0 db/pg_settings /dev/stdin
 
 ##
 ## Lesser used targets: