Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default - Mailing list pgsql-bugs

From Andrew Dunstan
Subject Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default
Date
Msg-id 4726f847-68fb-a7fc-c5e9-7b9536046fc4@dunslane.net
Whole thread Raw
In response to Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default
List pgsql-bugs
On 6/10/21 6:10 PM, Tom Lane wrote:
> PG Bug reporting form <noreply@postgresql.org> 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




pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17057: Unexpected error: ERROR: unsupported target type: 0
Next
From: Tom Lane
Date:
Subject: Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default