Move into separate file all the SQL queries used in pg_upgrade tests
authorMichael Paquier <michael@paquier.xyz>
Thu, 2 Dec 2021 01:31:37 +0000 (10:31 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 2 Dec 2021 01:31:37 +0000 (10:31 +0900)
commitb6e525648d723fb915c4bd376de62f4e28099189
treecad335b6b2753f9ffa9e58bf7815c0bf27ce7627
parent5cf08b4db79d6e3a82c4b92f8c9cf35e87c70d01
Move into separate file all the SQL queries used in pg_upgrade tests

The existing pg_upgrade/test.sh and the buildfarm code have been holding
the same set of SQL queries when doing cross-version upgrade tests to
adapt the objects created by the regression tests before the upgrade
(mostly, incompatible or non-existing objects need to be dropped from
the origin, perhaps re-created).

This moves all those SQL queries into a new, separate, file with a set
of \if clauses to handle the version checks depending on the old version
of the cluster to-be-upgraded.

The long-term plan is to make the buildfarm code re-use this new SQL
file, so as committers are able to fix any compatibility issues in the
tests of pg_upgrade with a refresh of the core code, without having to
poke at the buildfarm client.  Note that this is only able to handle the
main regression test suite, and that nothing is done yet for contrib
modules yet (these have more issues like their database names).

A backpatch down to 10 is done, adapting the version checks as this
script needs to be only backward-compatible, so as it becomes possible
to clean up a maximum amount of code within the buildfarm client.

Author: Justin Pryzby, Michael Paquier
Discussion: https://postgr.es/m/20201206180248.GI24052@telsasoft.com
Backpatch-through: 10
src/bin/pg_upgrade/test.sh
src/bin/pg_upgrade/upgrade_adapt.sql [new file with mode: 0644]