From: hubert depesz lubaczewski <depesz@depesz.com>
To: Denis de Bernardy <ddebernardy@yahoo.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8226: Inconsistent unnesting of arrays
Date: Wed, 12 Jun 2013 13:03:04 +0200
Message-ID: <20130612110304.GA20851@depesz.com> (raw)
In-Reply-To: <336D0D5D-A04D-4E71-B78F-484017B74F81@yahoo.com>
References: <E1UmgtE-0002si-0x@wrigleys.postgresql.org>
<CAM-w4HNZ-6X9eAwtCY72Gff3ihOpUF-L2x2+3Wt7=+A7aaJ5+A@mail.gmail.com>
<336D0D5D-A04D-4E71-B78F-484017B74F81@yahoo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On Wed, Jun 12, 2013 at 12:19:51PM +0200, Denis de Bernardy wrote:
> Methinks the behavior should be consistent. It should always do one
> (presumably like in the first statement) or the other (which leads to
> undefined behavior in the first statement).
It is consistent. You just assume it does something else than what it
does.
It reads values from both sources, until both of them will at the same
time.
If any of them ends earlier, it is scanned again from beginning.
This can be seen, for example, with:
select unnest('{a,b,c,d,e,f}'::text[]), unnest('{1,2,3}'::text[]);
Or, perhaps better, with this one:
select unnest('{a,b,c,d,e,f}'::text[]), unnest('{1,2,3,4}'::text[]);
It doesn't show 6 rows (as first array), or 4 (as the other). or 24 (6
* 4). It shows 12, because this is the smallest common multiple of 6 and
4.
depesz
--
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: depesz@depesz.com, ddebernardy@yahoo.com
Subject: Re: BUG #8226: Inconsistent unnesting of arrays
In-Reply-To: <20130612110304.GA20851@depesz.com>
References: <E1UmgtE-0002si-0x@wrigleys.postgresql.org> <CAM-w4HNZ-6X9eAwtCY72Gff3ihOpUF-L2x2+3Wt7=+A7aaJ5+A@mail.gmail.com> <336D0D5D-A04D-4E71-B78F-484017B74F81@yahoo.com> <20130612110304.GA20851@depesz.com>
* 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