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 1lrTZz-0006Q8-81 for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Jun 2021 22:55:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lrTZx-0006Tk-0W for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Jun 2021 22:55:13 +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 1lrTZw-0006Sx-Q8 for pgsql-bugs@lists.postgresql.org; Thu, 10 Jun 2021 22:55:12 +0000 Received: from relay12.mail.gandi.net ([217.70.178.232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrTZt-0007aj-Nl for pgsql-bugs@lists.postgresql.org; Thu, 10 Jun 2021 22:55:11 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 544D4200002; Thu, 10 Jun 2021 22:55:06 +0000 (UTC) Subject: Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default To: Tom Lane , exclusion@gmail.com Cc: pgsql-bugs@lists.postgresql.org References: <17056-4f6f7243d322be6b@postgresql.org> <1806408.1623363029@sss.pgh.pa.us> From: Andrew Dunstan Message-ID: <4726f847-68fb-a7fc-c5e9-7b9536046fc4@dunslane.net> Date: Thu, 10 Jun 2021 18:55:05 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <1806408.1623363029@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/10/21 6:10 PM, Tom Lane wrote: > PG Bug reporting form writes: >> CREATE FOREIGN DATA WRAPPER dummy; >> CREATE SERVER s0 FOREIGN DATA WRAPPER dummy; >> CREATE FOREIGN TABLE ft1 (c1 integer NOT NULL) SERVER s0; >> ALTER FOREIGN TABLE ft1 ADD COLUMN c8 integer DEFAULT 0; >> ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE char(10); > Hmm. The equivalent DDL on a plain table works fine, but this is > crashing in the code that manipulates attmissingval. I suspect some > confusion about whether a foreign table column should even *have* > attmissingval. Andrew, any thoughts? > > My initial thought would be that it should not. If the foreign table has rows with missing columns then it should be up to the foreign server to supply them transparently. We have no notion what the foreign semantics of missing columns are. I can take a look at a fix tomorrow. My inclination would be simply to skip setting attmissingval for foreign tables. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com