I recall that http://blog.heapanalytics.com/postgresqls-powerful-new-join-type-lateral/ shows how Pg 9.3's LATERAL join is useful in practice, as it lets you do in declarational SQL what you may have needed procedural code for before, in which case it is an improvement. -- Darren Duncan

On 2015-02-08 9:12 PM, James K. Lowden wrote:
On Sun, 8 Feb 2015 23:52:43 +0100
Big Stone <stonebi...@gmail.com> wrote:

I fall over this presentation of LATERAL, from postgresql guys.

Does it exist in SQLITE ?

Syntactically, no.  Functionally, in part.

If not, would it be possible too much effort ?

I'm guessing the answer is No because the prerequisites are missing.

Something like LATERAL (or APPLY in SQL Server) arises around
table-valued functions, which really should be called parameterized
views.  You think you'd like to be able to say,

        SELECT S.*
        FROM T join F(T.t) as S on T.t < S.x

where F is some function that produces a table for a scalar/row
input.

However, perfectly nothing new is really needed to express the idea:

        SELECT S.*
        FROM (select F(t) from T) as S
        WHERE EXISTS (select 1 from T where S.x > T.t)

I suspect that new syntax like this is usually added to SQL for the
wrong reasons.

1.  Marketing.  Now with LATERAL added!
2.  User-imagined need, because don't know SQL
3.  Punt on query optimization, invent keyword as hint

In each case, they have added complexity without power.  The "improved"
system is harder to use and to develop.  But, hey, it's progress.

?Perfection is achieved not when there is nothing
left to add, but when there is nothing left to take away?
? Antoine de Saint-Exupery

--jkl

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to