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 1iKfvE-0000nT-IK for pgsql-committers@arkaria.postgresql.org; Wed, 16 Oct 2019 09:48:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iKfvD-0008T9-CR for pgsql-committers@arkaria.postgresql.org; Wed, 16 Oct 2019 09:48:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iKfvB-0007w5-6G for pgsql-committers@lists.postgresql.org; Wed, 16 Oct 2019 09:48:47 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iKfv7-0001a5-SN for pgsql-committers@lists.postgresql.org; Wed, 16 Oct 2019 09:48:43 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 49065DC4; Wed, 16 Oct 2019 05:48:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 16 Oct 2019 05:48:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=eDb9RS1GS9sVmeY6x5C1dekZrEi TmMES20GSleC3Ly8=; b=SbaykmJzXrHUvhP87d+VyfQ6WoGvYob1MOU7IzJ1pbD 91HeSIbk8YQualrramWO1MUrK+wo4cXvjGQAFvWxYeTZiQkOvRND8QZE5qzuSbht UpM7sNmz4A1fvTczLQhOE0qtByLxhwWZ1B9x+pdvNVk1FBitXrPeNWEZlT+zeOBM Ioi4S7U2XExCi/MCHMSOHmSUiDFWqkQwyyyN+WMAVcmEAYkSiAojPAJlX4BiO0w5 cCT9WuVy8cgKGRRYH2YLi7LnvcEZXogZvnXt95MzkB7lLxOnu11JVrL777IkJqol 6uGooQwwB//mKCIi6Yjg7LatoHYWVtNOYEs0S7asllA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=eDb9RS 1GS9sVmeY6x5C1dekZrEiTmMES20GSleC3Ly8=; b=CYnrYjhqOA4C5GO4v1C6VT X6LdTc/jXVtRaUE1F8NFkGMpdoZDEG2jo9y6Vg4LNdRvVmfRk3pTkvZJL5EqW5Dk yys7xroYoMNER7jBjLRyf9lFLqFofxvyS5dmYADM2qON+7lzA/wdn2zsYPydq1il 668Gl2dacwqqNeU3xUpiKjZftJ1VhSdfo3Q+4BIu8GCuU9vDN8KduX04k16qCE/E fBoPwwyvex+9/NB6UmvMxKbs8XFWBCArRdBu3syjtWN/67+BXZlZSxevVBP85J3f 5IITHOKhDI/Dx7uN25Qsu/Kk6fMIjsXBKu9zD/IwnBWUXwXJxZ8Fv72xH/pekq8g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrjeehgddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttdertd dttddvnecuhfhrohhmpeetnhgurhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgr rhgriigvlhdruggvqeenucfkphepvddufedrvdduhedrvdeghedriedvnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvgenucevlhhushht vghrufhiiigvpedt X-ME-Proxy: Received: from intern.anarazel.de (unknown [213.215.245.62]) by mail.messagingengine.com (Postfix) with ESMTPA id 184CBD60065; Wed, 16 Oct 2019 05:48:38 -0400 (EDT) Date: Wed, 16 Oct 2019 02:48:36 -0700 From: Andres Freund To: Tom Lane Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix table rewrites that include a column without a default. Message-ID: <20191016094836.nh3akqg2j72wncnz@alap3.anarazel.de> References: <3328.1570740683@sss.pgh.pa.us> <20191010205903.tj73q3qcyfft3izz@alap3.anarazel.de> <4541.1570742168@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4541.1570742168@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-10-10 17:16:08 -0400, Tom Lane wrote: > If you just want to verify that a rewrite happened or didn't happen, > seems like you could check whether the table's relfilenode changed. > > regression=# select relfilenode as oldfilenode from pg_class where relname = 'rewrite_test' > regression-# \gset > regression=# select relfilenode != :oldfilenode as changed from pg_class where relname = 'rewrite_test'; > changed > --------- > f > (1 row) > regression=# alter table rewrite_test alter column notempty3_norewrite type bigint; > ALTER TABLE > regression=# select relfilenode != :oldfilenode as changed from pg_class where relname = 'rewrite_test'; > changed > --------- > t > (1 row) This felt verbose to me over a number of to-be-tested statements, so I instead replaced it with a plpgsql function that EXECUTEs the DDL and returns whether a rewrite happened. I'll assume/hope that that fixes the occasional bf failures. Greetings, Andres Freund