Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default
Date: 2021-06-12 21:40:38
Message-ID: cad1e46d-260b-2794-299b-1c6112f6c389@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


On 6/10/21 7:11 PM, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>> On 6/10/21 6:10 PM, Tom Lane wrote:
>>> 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.
> Yeah, that was kind of what I thought. Probably only RELKIND_RELATION
> rels should ever have attmissingval; but certainly, anything without
> local storage should not.
>
>> I can take a look at a fix tomorrow. My inclination would be simply to
>> skip setting attmissingval for foreign tables.
> Seems like in addition to that, we'll need a defense in this specific
> code to cope with the case where the foreign column already has an
> attmissingval. Or maybe, the logic to not store a new one will be enough
> to keep us from reaching this crash; but we need to be sure it is enough.

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.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachment Content-Type Size
nonlocal-missing-values-fix2.patch text/x-patch 2.7 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2021-06-12 21:50:03 Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default
Previous Message Michael Paquier 2021-06-12 06:32:12 Re: BUG #17055: Logical replication worker crashes when applying update of row that dose not exist in target partiti

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-06-12 21:50:03 Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default
Previous Message Fabien COELHO 2021-06-12 21:32:54 Re: Error on pgbench logs