From: | "Anton A(dot) Melnikov" <aamelnikov(at)inbox(dot)ru> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz>, Justin Pryzby <pryzby(at)telsasoft(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: [BUG] pg_upgrade test fails from older versions. |
Date: | 2022-12-23 09:43:00 |
Message-ID: | 2de1593a-3281-88aa-3dad-11c3c3fadf2c@inbox.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Sorry, didn't get to see the last letter!
On 23.12.2022 11:51, Michael Paquier wrote:
>
> FWIW, I find the use of a FOR loop with a DO block much cleaner to
> follow in this context, so something like the attached would be able
> to group the two queries and address your point on O(N^2). Do you
> like that?
> --
> Michael
The query:
DO $$
DECLARE
rec record;
BEGIN
FOR rec in
SELECT oid::regclass::text as rel, attname as col
FROM pg_class c, pg_attribute a
WHERE c.relname !~ '^pg_'
AND c.relkind IN ('r')
AND a.attrelid = c.oid
AND a.atttypid = 'aclitem'::regtype
ORDER BY 1
LOOP
EXECUTE 'ALTER TABLE ' || quote_ident(rec.rel) || ' ALTER COLUMN ' ||
quote_ident(rec.col) || ' SET DATA TYPE text';
END LOOP;
END; $$;
gives the average time of 36 ms at the same conditions.
With the best wishes!
--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
From | Date | Subject | |
---|---|---|---|
Next Message | shveta malik | 2022-12-23 09:45:54 | Re: Force streaming every change in logical decoding |
Previous Message | houzj.fnst@fujitsu.com | 2022-12-23 09:20:01 | RE: Perform streaming logical transactions by background workers and parallel apply |