From: Justin Pryzby <pryzby@telsasoft.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Anton A. Melnikov <aamelnikov@inbox.ru>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [BUG] pg_upgrade test fails from older versions.
Date: Thu, 22 Dec 2022 21:27:24 -0600
Message-ID: <20221223032724.GQ1153@telsasoft.com> (raw)
In-Reply-To: <Y6UVn1xZ5fx00qeP@paquier.xyz>
References: <49f389ba-95ce-8a9b-09ae-f60650c0e7c7@inbox.ru>
<819272.1671415008@sss.pgh.pa.us>
<Y5/XgkzX2LVe7PvZ@paquier.xyz>
<f9d65c82-ebef-4ff8-1055-b1b704a19995@inbox.ru>
<Y6UVn1xZ5fx00qeP@paquier.xyz>
On Fri, Dec 23, 2022 at 11:42:39AM +0900, Michael Paquier wrote:
> Hmm. 0001 does a direct check on aclitem as data type used in an
> attribute,
> For now, I have fixed the most pressing part for tables to match with
> the buildfarm
+DO $$
+ DECLARE
+ rec text;
+ col text;
+ BEGIN
+ FOR rec in
+ SELECT oid::regclass::text
+ FROM pg_class
+ WHERE relname !~ '^pg_'
+ AND relkind IN ('r')
+ ORDER BY 1
+ LOOP
+ FOR col in SELECT attname FROM pg_attribute
+ WHERE attrelid::regclass::text = rec
+ AND atttypid = 'aclitem'::regtype
+ LOOP
+ EXECUTE 'ALTER TABLE ' || quote_ident(rec) || ' ALTER COLUMN ' ||
+ quote_ident(col) || ' SET DATA TYPE text';
+ END LOOP;
+ END LOOP;
+ END; $$;
This will do a seq scan around pg_attribute for each relation (currently
~600)...
Here, that takes a few seconds in a debug build, and I guess it'll be
more painful when running under valgrind/discard_caches/antiquated
hardware/etc.
This would do a single seqscan:
SELECT format('ALTER TABLE %I ALTER COLUMN %I TYPE TEXT', attrelid::regclass, attname) FROM pg_attribute WHERE atttypid='aclitem'::regtype; -- AND ...
\gexec
--
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, michael@paquier.xyz, aamelnikov@inbox.ru, tgl@sss.pgh.pa.us
Subject: Re: [BUG] pg_upgrade test fails from older versions.
In-Reply-To: <20221223032724.GQ1153@telsasoft.com>
References: <49f389ba-95ce-8a9b-09ae-f60650c0e7c7@inbox.ru> <819272.1671415008@sss.pgh.pa.us> <Y5/XgkzX2LVe7PvZ@paquier.xyz> <f9d65c82-ebef-4ff8-1055-b1b704a19995@inbox.ru> <Y6UVn1xZ5fx00qeP@paquier.xyz> <20221223032724.GQ1153@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox