Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf4f2f2b

Browse files
committed
Update upgrade_adapt.sql to handle tables using aclitem as data type
The regression test suite includes a table called "tab_core_types" thathas one attribute based on the type "aclitem". Keeping this attributeas-is causes hard failures when running pg_upgrade with an origin on~15. This commit updates upgrade_adapt.sql to automatically detect thetables with such attributes and switch them to text so as pg_upgradeis able to go through its run.This does not provide the same detection coverage as pg_upgrade, wherewe are able to find out aclitems used in arrays, domains or evencomposite types, but this is (I guess) enough for most things like aninstance that had installcheck run on before the upgrade with a dumpgenerated from it.Note that the buildfarm code has taken the simplest approach of justdropping "tab_core_types", so what we have here is more modular.Author: Anton A. MelnikovDiscussion:https://postgr.es/m/49f389ba-95ce-8a9b-09ae-f60650c0e7c7@inbox.ru
1 parent3022cb1 commitf4f2f2b

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

‎src/bin/pg_upgrade/upgrade_adapt.sql

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ SELECT
1919
ver<=906AS oldpgversion_le96,
2020
ver<=1000AS oldpgversion_le10,
2121
ver<=1100AS oldpgversion_le11,
22-
ver<=1300AS oldpgversion_le13
22+
ver<=1300AS oldpgversion_le13,
23+
ver<=1500AS oldpgversion_le15
2324
FROM (SELECT current_setting('server_version_num')::int/100AS ver)AS v;
2425
\gset
2526

@@ -89,3 +90,30 @@ DROP OPERATOR public.#%# (pg_catalog.int8, NONE);
8990
DROPOPERATOR public.!=- (pg_catalog.int8, NONE);
9091
DROPOPERATOR public.#@%# (pg_catalog.int8, NONE);
9192
\endif
93+
94+
-- Objects last appearing in 15.
95+
-- The internal format of "aclitem" has changed in 16, so replace it with
96+
-- text type in tables.
97+
\if :oldpgversion_le15
98+
DO $$
99+
DECLARE
100+
rectext;
101+
coltext;
102+
BEGIN
103+
FOR recin
104+
SELECToid::regclass::text
105+
FROM pg_class
106+
WHERE relname !~'^pg_'
107+
AND relkindIN ('r')
108+
ORDER BY1
109+
LOOP
110+
FOR colinSELECT attnameFROM pg_attribute
111+
WHERE attrelid::regclass::text= rec
112+
AND atttypid='aclitem'::regtype
113+
LOOP
114+
EXECUTE'ALTER TABLE'|| quote_ident(rec)||' ALTER COLUMN'||
115+
quote_ident(col)||' SET DATA TYPE text';
116+
END LOOP;
117+
END LOOP;
118+
END; $$;
119+
\endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp