From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: kadek.marek@gmail.com
Subject: BUG #15291: Lateral join has different/suprising semantics (with impure function)
Date: Tue, 24 Jul 2018 07:10:26 +0000
Message-ID: <153241622629.1395.7281368493830784815@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15291
Logged by: Marek K.
Email address: kadek.marek@gmail.com
PostgreSQL version: 11beta2
Operating system: Ubuntu, OSX
Description:
Following SQL:
CREATE EXTENSION "uuid-ossp";
CREATE TABLE fruits (name VARCHAR);
INSERT INTO fruits VALUES ('banana'), ('apple');
-- 1:
-- banana | uuid1
-- apple | uuid1
SELECT f.name, t.uuid FROM fruits f
CROSS JOIN LATERAL (
SELECT uuid_generate_v4() AS uuid FROM (VALUES(1)) v
) t;
-- 2:
-- banana | uuid1
-- apple | uuid2
SELECT f.name, t.uuid FROM fruits f
CROSS JOIN LATERAL (
SELECT f.name, uuid_generate_v4() AS uuid FROM (VALUES(1)) v
) t
I can understand why it's happening what is happening, yet I still find it
to be problematic. In my opinion those two selects should yield same
results. Hence for impure functions lateral semantics should be preserved
and not optimized away.
I am not 100% sure it can be classified as a bug, but looking into what your
opinion is.
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: noreply@postgresql.org, kadek.marek@gmail.com
Subject: Re: BUG #15291: Lateral join has different/suprising semantics (with impure function)
In-Reply-To: <153241622629.1395.7281368493830784815@wrigleys.postgresql.org>
References: <153241622629.1395.7281368493830784815@wrigleys.postgresql.org>
* 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