Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIfPP-0003vc-4f for pgsql-committers@arkaria.postgresql.org; Thu, 10 Oct 2019 20:51:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iIfPN-0001Y1-0J for pgsql-committers@arkaria.postgresql.org; Thu, 10 Oct 2019 20:51:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIfPM-0001Xm-PM for pgsql-committers@lists.postgresql.org; Thu, 10 Oct 2019 20:51:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIfPE-0004O3-R0 for pgsql-committers@lists.postgresql.org; Thu, 10 Oct 2019 20:51:35 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9AKpNx0003329; Thu, 10 Oct 2019 16:51:23 -0400 From: Tom Lane To: Andres Freund cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix table rewrites that include a column without a default. In-reply-to: References: Comments: In-reply-to Andres Freund message dated "Thu, 10 Oct 2019 05:19:41 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3327.1570740683.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 10 Oct 2019 16:51:23 -0400 Message-ID: <3328.1570740683@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > Fix table rewrites that include a column without a default. This patch added use of an event trigger in alter_table.sql. As we have learned the hard way, it's not acceptable to create event triggers in test scripts that run in parallel with anything else, because they will intermittently screw up DDL happening in the parallel scripts. As seen just now on clam: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dclam&dt=3D2019-1= 0-10%2020%3A16%3A19 diff -U3 /home/pgbfarm/buildroot/HEAD/pgsql.build/src/test/regress/expecte= d/plpgsql.out /home/pgbfarm/buildroot/HEAD/pgsql.build/src/test/regress/re= sults/plpgsql.out --- /home/pgbfarm/buildroot/HEAD/pgsql.build/src/test/regress/expected/plp= gsql.out 2019-05-09 09:00:10.653795677 +0100 +++ /home/pgbfarm/buildroot/HEAD/pgsql.build/src/test/regress/results/plpg= sql.out 2019-10-10 21:21:46.406007734 +0100 @@ -5419,6 +5419,7 @@ -- 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 =3D (name::text || name::text)::integer; WARNING: old table =3D 1=3D11,2=3D22,3=3D33, new table =3D 1=3D1111,2=3D= 2222,3=3D3333 Do you *really* need an event trigger to test this? regards, tom lane