On Sun, 8 Feb 2015 23:52:43 +0100
Post by Big StoneI fall over this presentation of LATERAL, from postgresql guys.
Does it exist in SQLITE ?
Syntactically, no. Functionally, in part.
Post by Big StoneIf 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