From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pgsql: Fix table rewrites that include a column without a default. |
Date: | 2019-10-16 05:58:17 |
Message-ID: | 20191016055817.GE2602@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
On Thu, Oct 10, 2019 at 05:16:08PM -0400, Tom Lane wrote:
> I really really don't want an event trigger running in everything that
> runs in parallel with alter_table. That's a debugging nightmare of
> monster proportions.
+1, that's not stable. elver has just complained about a side effect
of this commit:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=elver&dt=2019-10-16%2005%3A04%3A24
-- now change 'name' to an integer to see what happens...
ALTER TABLE alter_table_under_transition_tables
ALTER COLUMN name TYPE int USING name::integer;
+WARNING: rewriting table alter_table_under_transition_tables
UPDATE alter_table_under_transition_tables
SET name = (name::text || name::text)::integer;
WARNING: old table = 1=11,2=22,3=33, new table = 1=1111,2=2222,3=3333
Another method would be to simply store the past relfilenodes into a
temporary table with the relation OID, and do a comparison with what's
in pg_class post-rewrite as some partition-related tests do in the
same file. For one relation the \gset method is more readable
anyway.
If you really wish to keep an event trigger, you could also apply a
filter within the function to only consider rewrite_test as something
to report about, still I would recommend avoiding global effects if
not necessary.
So I would fix the issue as per the attached, as Tom has suggested.
Thoughts?
--
Michael
Attachment | Content-Type | Size |
---|---|---|
alter-table-tests.patch | text/x-diff | 6.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-10-16 06:11:06 | pgsql: Refresh some incorrect links in pg_crc.c/h |
Previous Message | Thomas Munro | 2019-10-16 05:03:13 | pgsql: Remove obsolete collation test. |