Re: BUG #15291: Lateral join has different/suprising semantics (with impure function)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: kadek(dot)marek(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15291: Lateral join has different/suprising semantics (with impure function)
Date: 2018-07-24 13:50:33
Message-ID: 1235.1532440233@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

=?utf-8?q?PG_Bug_reporting_form?= <noreply(at)postgresql(dot)org> writes:
> [ LATERAL is ignored when sub-select has no actual lateral references ]

> 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 believe this behavior is effectively required by the SQL spec.
In any case, removing it would pessimize many queries in which writing
an unnecessary LATERAL has no bad side-effects today, so I'm disinclined
to change a behavior that's stood for half a dozen releases now.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-07-24 13:54:14 Re: BUG #15292: Multiple Messages "2018-07-24 10:46:12.566 CEST [32029] LOG: invalid length of startup" in logfile
Previous Message Sergei Kornilov 2018-07-24 13:19:45 Re: BUG #15293: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events