From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7808: unnest doesn't handle nulls in array of composite typescorrectly
Date: Tue, 26 Jul 2016 21:37:37 -0400
Message-ID: <4240.1469583457@sss.pgh.pa.us> (raw)
In-Reply-To: <87eg6koste.fsf@news-spur.riddles.org.uk>
References: <E1TurJE-0006Es-TK@wrigleys.postgresql.org>
<87wpkcpyud.fsf@news-spur.riddles.org.uk>
<18501.1469285358@sss.pgh.pa.us>
<87eg6koste.fsf@news-spur.riddles.org.uk>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
> Tom> I think the theory behind the existing code here is that if the
> Tom> SRF wants its output to be interpreted as an all-nulls row, it can
> Tom> perfectly well return an all-nulls row. I wonder whether we
> Tom> should address this by adjusting unnest's behavior instead.
> One problem with changing unnest() is that it makes the operation
> array(select unnest(a)) return an array that's not equal to the original
> one (and which takes up a lot more space if there are many nulls).
Fair point.
I didn't much like the "initial_nulls" counter in your patch, but actually
there's no reason we can't just push an all-nulls row into the tuplestore
immediately on seeing a null, the same way as happens in the last-ditch
case at the bottom of ExecMakeTableFunctionResult. I whacked that around
a bit and pushed it.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: tgl@sss.pgh.pa.us, andrew@tao11.riddles.org.uk
Subject: Re: BUG #7808: unnest doesn't handle nulls in array of composite typescorrectly
In-Reply-To: <4240.1469583457@sss.pgh.pa.us>
References: <E1TurJE-0006Es-TK@wrigleys.postgresql.org> <87wpkcpyud.fsf@news-spur.riddles.org.uk> <18501.1469285358@sss.pgh.pa.us> <87eg6koste.fsf@news-spur.riddles.org.uk> <4240.1469583457@sss.pgh.pa.us>
* 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