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 1lsBW5-0004sL-Nr for pgsql-bugs@arkaria.postgresql.org; Sat, 12 Jun 2021 21:50:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lsBW4-0007MY-Fd for pgsql-bugs@arkaria.postgresql.org; Sat, 12 Jun 2021 21:50:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lsBW4-0007MQ-8u for pgsql-bugs@lists.postgresql.org; Sat, 12 Jun 2021 21:50:08 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lsBW2-0007vA-93 for pgsql-bugs@lists.postgresql.org; Sat, 12 Jun 2021 21:50:07 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9348E5C00F0; Sat, 12 Jun 2021 17:50:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 12 Jun 2021 17:50:05 -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=fm1; bh=0TwMz+w9+PFziofwxQzTOY6YBQ5 o3m+uobGJ5kK1yuA=; b=SeRvTcoSmSdlOFlZmN7oKqAKTz1+3GlwUZyWwTMVd+Z W73Mj/cnCVjcJf5veB9fo6fwHxSgXnkRiSUxgwOqv3QYrhCIpiMOpXSKeVXePzar A1mbehalAhWBc3EgYVosGUT0/CtoiOPjLtZoUjK9D1pNXDApFM40m7dNIWgLvH8D zWWMw0p5yvXTgqEPuCMrndjwjZK6JqtCsZai9UppYCBfmBE7z+1f5X4U+Aeni5Ex gkV3Gi4xMRVMxAAE+htGjmUyFjK5ZCcBzZ2v//Ewl8XQ0QcxiRnJM4gvySqmpp1w QPFIpputeysMEpCxCFumgyavLnFvoG078tG4yNE3nNA== 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=fm3; bh=0TwMz+ w9+PFziofwxQzTOY6YBQ5o3m+uobGJ5kK1yuA=; b=osrJ+w3qmX6UUDn/+ilKkI WcPUGzEm3rD5+8gKxceEAQv2Hc8UGoEU9sx/WWMtWSsvd8vPidnrDgzmz7rsojYV 6PFiOqGY9nO4XQQtJ1glTvgeumN1Zscq/LIO89zfh9KJq2p73EaA5EoFcJe1N+cp mHrifd5oBx0ILAPYc/I5sjvfAUJ24pBo3K6jnJnX4VRcCTXNw13YSY/SyiAt7WxQ Zano69X+eQuabOXKF38h9C5zkkYvUZgbwRmsv5pt8WInqSVCbqLiFc9gYH4aCl8i rIePtUHtC8jhM5fZurg1fhQu4wJCamDuov8Sjwb/Jy3C+nwMYH/O/oLD5Njm3rNQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedvtddgudeilecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeff hfeuffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 12 Jun 2021 17:50:04 -0400 (EDT) Date: Sat, 12 Jun 2021 14:50:03 -0700 From: Andres Freund To: Andrew Dunstan Cc: 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: <20210612215003.ypu5uf2bfceofkkd@alap3.anarazel.de> References: <17056-4f6f7243d322be6b@postgresql.org> <1806408.1623363029@sss.pgh.pa.us> <4726f847-68fb-a7fc-c5e9-7b9536046fc4@dunslane.net> <1816295.1623366663@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2021-06-12 17:40:38 -0400, Andrew Dunstan wrote: > Ok, I think the attached is the least we need to do. Given this I > haven't been able to induce a crash even when the catalog is hacked with > bogus missing values on a foreign table. But I'm not 100% convinced I > have fixed all the places that need to be fixed. Hm. There's a few places that look at atthasmissing and just assume that there's corresponding information about the missing field. And as far as I can see the proposed changes in RelationBuildTupleDesc() don't unset atthasmissing, they just prevent the constraint part of the tuple desc from being filled. Wouldn't this cause problems if we reach code like Datum getmissingattr(TupleDesc tupleDesc, int attnum, bool *isnull) { Form_pg_attribute att; Assert(attnum <= tupleDesc->natts); Assert(attnum > 0); att = TupleDescAttr(tupleDesc, attnum - 1); if (att->atthasmissing) { AttrMissing *attrmiss; Assert(tupleDesc->constr); Assert(tupleDesc->constr->missing); attrmiss = tupleDesc->constr->missing + (attnum - 1); if (attrmiss->am_present) Greetings, Andres Freund