|
| 1 | +-- |
| 2 | +-- SQL queries for upgrade tests across different major versions. |
| 3 | +-- |
| 4 | +-- This file includes a set of SQL queries to make a cluster to-be-upgraded |
| 5 | +-- compatible with the version this file is based on. Note that this |
| 6 | +-- requires psql, as per-version queries are controlled with a set of \if |
| 7 | +-- clauses. |
| 8 | + |
| 9 | +-- This script is backward-compatible, so it is able to work with any version |
| 10 | +-- newer than 9.2 we are upgrading from, up to the branch this script is stored |
| 11 | +-- on (even if this would not run if running pg_upgrade with the same version |
| 12 | +-- for the origin and the target). |
| 13 | + |
| 14 | +-- \if accepts a simple boolean value, so all the version checks are |
| 15 | +-- saved based on this assumption. |
| 16 | +SELECT |
| 17 | + ver <= 902 AS oldpgversion_le92, |
| 18 | + ver <= 904 AS oldpgversion_le94, |
| 19 | + ver <= 906 AS oldpgversion_le96, |
| 20 | + ver <= 1000 AS oldpgversion_le10 |
| 21 | + FROM (SELECT current_setting('server_version_num')::int / 100 AS ver) AS v; |
| 22 | +\gset |
| 23 | + |
| 24 | +-- Objects last appearing in 9.2. |
| 25 | +\if :oldpgversion_le92 |
| 26 | +-- Note that those tables are removed from the regression tests in 9.3 |
| 27 | +-- and newer versions. |
| 28 | +DROP TABLE abstime_tbl; |
| 29 | +DROP TABLE reltime_tbl; |
| 30 | +DROP TABLE tinterval_tbl; |
| 31 | +\endif |
| 32 | + |
| 33 | +-- Objects last appearing in 9.4. |
| 34 | +\if :oldpgversion_le94 |
| 35 | +-- This aggregate has been fixed in 9.5 and later versions, so drop |
| 36 | +-- and re-create it. |
| 37 | +DROP AGGREGATE array_cat_accum(anyarray); |
| 38 | +CREATE AGGREGATE array_larger_accum (anyarray) ( |
| 39 | + sfunc = array_larger, |
| 40 | + stype = anyarray, |
| 41 | + initcond = $${}$$); |
| 42 | +-- This operator has been fixed in 9.5 and later versions, so drop and |
| 43 | +-- re-create it. |
| 44 | +DROP OPERATOR @#@ (NONE, bigint); |
| 45 | +CREATE OPERATOR @#@ (PROCEDURE = factorial, |
| 46 | + RIGHTARG = bigint); |
| 47 | +\endif |
| 48 | + |
| 49 | +-- Objects last appearing in 9.6. |
| 50 | +\if :oldpgversion_le96 |
| 51 | +DROP FUNCTION public.oldstyle_length(integer, text); |
| 52 | +\endif |
| 53 | + |
| 54 | +-- Objects last appearing in 10. |
| 55 | +\if :oldpgversion_le10 |
| 56 | +DROP FUNCTION IF EXISTS boxarea(box); |
| 57 | +DROP FUNCTION IF EXISTS funny_dup17(); |
| 58 | +\endif |
0 commit comments