From: Tom Lane <tgl@sss.pgh.pa.us>
To: Aron Widforss <pgsql-general@antarkt.is>
Cc: pgsql-general@postgresql.org
Subject: Re: Multiple unnests in query
Date: Sun, 12 Nov 2017 20:51:01 -0500
Message-ID: <5065.1510537861@sss.pgh.pa.us> (raw)
In-Reply-To: <1510536178.2747282.1170204616.4A024CB2@webmail.messagingengine.com>
References: <1510536178.2747282.1170204616.4A024CB2@webmail.messagingengine.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
Aron Widforss <pgsql-general@antarkt.is> writes:
> Is this first query expected behavior? If so, what is the rationale?
The short answer is "because it's always worked that way". You
might find the last half of section 37.4.8 illuminating:
https://www.postgresql.org/docs/devel/static/xfunc-sql.html#XFUNC-SQL-FUNCTIONS-RETURNING-SET
but if you're on a pre-v10 release, pay close attention to what it says
about the difference between v10 and pre-v10 behavior.
> I would have expected nine rows returned (as in my second example).
Your second example has approximately nothing to do with your first.
It has only one SRF in the SELECT list, so there's not much doubt
about what ought to happen.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-general@antarkt.is
Subject: Re: Multiple unnests in query
In-Reply-To: <5065.1510537861@sss.pgh.pa.us>
References: <1510536178.2747282.1170204616.4A024CB2@webmail.messagingengine.com> <5065.1510537861@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