From: Andrew Dunstan <andrew@dunslane.net>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default
Date: Mon, 14 Jun 2021 16:29:06 -0400
Message-ID: <88b58d12-7609-97e9-a50e-8cfaae9790aa@dunslane.net> (raw)
In-Reply-To: <202106141913.cbzfrrcoinxx@alvherre.pgsql>
References: <202106141913.cbzfrrcoinxx@alvherre.pgsql>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: andrew@dunslane.net, alvherre@alvh.no-ip.org, andres@anarazel.de, tgl@sss.pgh.pa.us, exclusion@gmail.com
Subject: Re: BUG #17056: Segmentation fault on altering the type of the foreign table column with a default
In-Reply-To: <88b58d12-7609-97e9-a50e-8cfaae9790aa@dunslane.net>
References: <202106141913.cbzfrrcoinxx@alvherre.pgsql> <88b58d12-7609-97e9-a50e-8cfaae9790aa@dunslane.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox