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: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-14 20:29:06
Message-ID: 88b58d12-7609-97e9-a50e-8cfaae9790aa@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


On 6/14/21 3:13 PM, Alvaro Herrera wrote:
> 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).

OK, will change.

>
>> /*
>> * 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.

Well AFAIK this is the only place we actually need this combination of
tests, and I'm not a huge fan of defining a macro to use in one spot.

cheers

andrew

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2021-06-14 23:48:06 Re: Problem with the Polish language
Previous Message Alvaro Herrera 2021-06-14 19:13:21 Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-06-14 20:40:10 Re: Failure in subscription test 004_sync.pl
Previous Message Bruce Momjian 2021-06-14 20:12:20 Re: PG 14 release notes, first draft