pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Andrew Dunstan <andrew@dunslane.net>
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: Sat, 12 Jun 2021 14:50:03 -0700
Message-ID: <20210612215003.ypu5uf2bfceofkkd@alap3.anarazel.de> (raw)
In-Reply-To: <cad1e46d-260b-2794-299b-1c6112f6c389@dunslane.net>
References: <17056-4f6f7243d322be6b@postgresql.org>
	<1806408.1623363029@sss.pgh.pa.us>
	<4726f847-68fb-a7fc-c5e9-7b9536046fc4@dunslane.net>
	<1816295.1623366663@sss.pgh.pa.us>
	<cad1e46d-260b-2794-299b-1c6112f6c389@dunslane.net>

Hi,

On 2021-06-12 17:40:38 -0400, Andrew Dunstan wrote:
> 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.

Hm. There's a few places that look at atthasmissing and just assume that
there's corresponding information about the missing field. And as far as
I can see the proposed changes in RelationBuildTupleDesc() don't unset
atthasmissing, they just prevent the constraint part of the tuple desc
from being filled. Wouldn't this cause problems if we reach code like

Datum
getmissingattr(TupleDesc tupleDesc,
			   int attnum, bool *isnull)
{
	Form_pg_attribute att;

	Assert(attnum <= tupleDesc->natts);
	Assert(attnum > 0);

	att = TupleDescAttr(tupleDesc, attnum - 1);

	if (att->atthasmissing)
	{
		AttrMissing *attrmiss;

		Assert(tupleDesc->constr);
		Assert(tupleDesc->constr->missing);

		attrmiss = tupleDesc->constr->missing + (attnum - 1);

		if (attrmiss->am_present)


Greetings,

Andres Freund





view thread (12+ messages)  latest in thread

Message-ID: <20210612215003.ypu5uf2bfceofkkd@alap3.anarazel.de>
Permalink:  ../20210612215003.ypu5uf2bfceofkkd@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20210612215003.ypu5uf2bfceofkkd@alap3.anarazel.de

 · 

reply

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: andres@anarazel.de, andrew@dunslane.net, 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: <20210612215003.ypu5uf2bfceofkkd@alap3.anarazel.de>
  References: <17056-4f6f7243d322be6b@postgresql.org> <1806408.1623363029@sss.pgh.pa.us> <4726f847-68fb-a7fc-c5e9-7b9536046fc4@dunslane.net> <1816295.1623366663@sss.pgh.pa.us> <cad1e46d-260b-2794-299b-1c6112f6c389@dunslane.net> <20210612215003.ypu5uf2bfceofkkd@alap3.anarazel.de>

* 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