Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lss1a-0001AS-7X for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Jun 2021 19:13:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lss1Z-0003Ou-3P for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Jun 2021 19:13:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lss1Y-0003Oh-Sx for pgsql-bugs@lists.postgresql.org; Mon, 14 Jun 2021 19:13:28 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lss1W-0002Mf-JS for pgsql-bugs@lists.postgresql.org; Mon, 14 Jun 2021 19:13:28 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 51CE95C0129; Mon, 14 Jun 2021 15:13:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 14 Jun 2021 15:13:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=HA1KjfDPedoManMGRJ8G6lww/9vvPdArw+qHiJLFdEo=; b=ViNHJ1/M msSuca8RYYlx2BRX6+DhvwqcMpVphDflYzxe1+ImoECCJiEzSp+Z7CIXdh7HS2kB V8E5Eg81Dfu4MQi6mXqzqV0OfADw+Z21o8kF4UYCexMX6+1qEiGPZPq16pBf07BZ EkklyP/kwolA2ZeSj/f1GqrmZNSK8oShoIv63bkjomqUzM2cuw5uDamoXgPH+rTV T/ilxSe7FQqOD/x8NSMJabenl8v33J8lAJFLbXBNjBMojZOHRqSec9ryb0NusiAT X1eMMq9tFZQCdmxHpojWICfZTDqxsfM0zW9cB6m+12X0i8RVU2viXp5LGKHM34qA u67/bdPNvWZ1Bw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedvhedgudeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtugfgjgesthekredttddtudenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepgeegveevffevjeffudethfdvtdeggefhhffguefhfeej iefgvefhfeelvedtudetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Jun 2021 15:13:24 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id B1F972A0AA6; Mon, 14 Jun 2021 15:13:21 -0400 (-04) Date: Mon, 14 Jun 2021 15:13:21 -0400 From: Alvaro Herrera To: Andrew Dunstan Cc: Andres Freund , Tom Lane , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default Message-ID: <202106141913.cbzfrrcoinxx@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <759e997e-e1ca-91cd-84db-f4ae963fada1@dunslane.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Jun-12, Andrew Dunstan wrote: > + /* Don't do anything unless it's a RELKIND type relation */ > + if (tablerel->rd_rel->relkind != RELKIND_RELATION) > + { > + table_close(tablerel, AccessExclusiveLock); > + return; > + } "RELKIND type relation" is the wrong phrase ... maybe "it's a plain table" is good enough? (Ditto in RelationBuildTupleDesc). > /* > * Here we go --- change the recorded column type and collation. (Note > * heapTup is a copy of the syscache entry, so okay to scribble on.) First > - * fix up the missing value if any. > + * fix up the missing value if any. There shouldn't be any missing values > + * for anything except RELKIND_RELATION relations, but if there are, ignore > + * them. > */ > - if (attTup->atthasmissing) > + if (rel->rd_rel->relkind == RELKIND_RELATION && attTup->atthasmissing) Would it be sensible to have a macro "AttributeHasMissingVal(rel, attTup)", to use instead of reading atthasmissing directly? The macro would check the relkind, and also serve as documentation that said check is necessary. -- Álvaro Herrera 39°49'30"S 73°17'W "Uno puede defenderse de los ataques; contra los elogios se esta indefenso"