diff options
| author | Tom Lane | 2023-01-17 01:35:53 +0000 |
|---|---|---|
| committer | Tom Lane | 2023-01-17 01:35:53 +0000 |
| commit | 3f0b9df88bb33ec52b0af8b11295d256d2011e29 (patch) | |
| tree | 39ba5d38e2b80eb6979614f30d198a10a840590f /src/bin | |
| parent | cf74b6eadb9d8fcfd51a99e9cc6b04d019e36b12 (diff) | |
Create common infrastructure for cross-version upgrade testing.
To test pg_upgrade across major PG versions, we have to be able to
modify or drop any old objects with no-longer-supported properties,
and we have to be able to deal with cosmetic changes in pg_dump output.
Up to now, the buildfarm and pg_upgrade's own test infrastructure had
separate implementations of the former, and we had nothing but very
ad-hoc rules for the latter (including an arbitrary threshold on how
many lines of unchecked diff were okay!). This patch creates a Perl
module that can be shared by both those use-cases, and adds logic
that deals with pg_dump output diffs in a much more tightly defined
fashion.
This largely supersedes previous efforts in commits 0df9641d3,
9814ff550, and 62be9e4cd, which developed a SQL-script-based solution
for the task of dropping old objects. There was nothing fundamentally
wrong with that work in itself, but it had no basis for solving the
output-formatting problem. The most plausible way to deal with
formatting is to build a Perl module that can perform editing on the
dump files; and once we commit to that, it makes more sense for the
same module to also embed the knowledge of what has to be done for
dropping old objects.
Back-patch versions of the helper module as far as 9.2, to
support buildfarm animals that still test that far back.
It's also necessary to back-patch PostgreSQL/Version.pm,
because the new code depends on that. I fixed up pg_upgrade's
002_pg_upgrade.pl in v15, but did not look into back-patching
it further than that.
Tom Lane and Andrew Dunstan
Discussion: https://postgr.es/m/891521.1673657296@sss.pgh.pa.us
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_upgrade/upgrade_adapt.sql | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/bin/pg_upgrade/upgrade_adapt.sql b/src/bin/pg_upgrade/upgrade_adapt.sql deleted file mode 100644 index 37a4aad2f33..00000000000 --- a/src/bin/pg_upgrade/upgrade_adapt.sql +++ /dev/null @@ -1,80 +0,0 @@ --- --- SQL queries for upgrade tests across different major versions. --- --- This file includes a set of SQL queries to make a cluster to-be-upgraded --- compatible with the version this file is based on. Note that this --- requires psql, as per-version queries are controlled with a set of \if --- clauses. - --- This script is backward-compatible, so it is able to work with any version --- newer than 9.2 we are upgrading from, up to the branch this script is stored --- on (even if this would not run if running pg_upgrade with the same version --- for the origin and the target). - --- \if accepts a simple boolean value, so all the version checks are --- saved based on this assumption. -SELECT - ver <= 902 AS oldpgversion_le92, - ver <= 904 AS oldpgversion_le94, - ver <= 906 AS oldpgversion_le96, - ver <= 1000 AS oldpgversion_le10, - ver <= 1100 AS oldpgversion_le11 - FROM (SELECT current_setting('server_version_num')::int / 100 AS ver) AS v; -\gset - --- Objects last appearing in 9.2. -\if :oldpgversion_le92 --- Note that those tables are removed from the regression tests in 9.3 --- and newer versions. -DROP TABLE abstime_tbl; -DROP TABLE reltime_tbl; -DROP TABLE tinterval_tbl; -\endif - --- Objects last appearing in 9.4. -\if :oldpgversion_le94 --- This aggregate has been fixed in 9.5 and later versions, so drop --- and re-create it. -DROP AGGREGATE array_cat_accum(anyarray); -CREATE AGGREGATE array_larger_accum (anyarray) ( - sfunc = array_larger, - stype = anyarray, - initcond = $${}$$); --- This operator has been fixed in 9.5 and later versions, so drop and --- re-create it. -DROP OPERATOR @#@ (NONE, bigint); -CREATE OPERATOR @#@ (PROCEDURE = factorial, - RIGHTARG = bigint); -\endif - --- Objects last appearing in 9.6. -\if :oldpgversion_le96 -DROP FUNCTION public.oldstyle_length(integer, text); -\endif - --- Objects last appearing in 10. -\if :oldpgversion_le10 -DROP FUNCTION IF EXISTS boxarea(box); -DROP FUNCTION IF EXISTS funny_dup17(); -\endif - --- Objects last appearing in 11. -\if :oldpgversion_le11 --- WITH OIDS is supported until v11, so remove its support for any --- relations marked as such. -DO $stmt$ - DECLARE - rec text; - BEGIN - FOR rec in - SELECT oid::regclass::text - FROM pg_class - WHERE relname !~ '^pg_' - AND relhasoids - AND relkind in ('r', 'f') - ORDER BY 1 - LOOP - EXECUTE 'ALTER TABLE ' || quote_ident(rec) || ' SET WITHOUT OIDS'; - END LOOP; - END; $stmt$; -\endif |
