Hello Tom, Il giorno mer, 29/03/2017 alle 09.59 -0400, Tom Lane ha scritto: [...] > > Furthermore, let's assume postgres does a cartesian product, if I > > add a > > new relation as third element, does it create 4x3 product? > > You've hit on the reason why it's semantically ugly: it's not very > clear what to do with multiple SRFs in one targetlist. LATERAL, > together with the ROWS FROM construct, allows clear specification > of both of the useful behaviors (cartesian product and eval-set- > returning-functions-in-lockstep). The multiple-SRFs-in-targetlist > behavior that we inherited from Berkeley is just a mess, as it > effectively runs the SRFs until reaching the least common multiple of > their periods. We're changing that for v10 though. You might find > this commit informative (at least the commit message and > documentation > changes): > > https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=69f4b9c85 Thanks for the detailed answer. I'll better study LATERAL joins and change my query. BTW, the commit you pointed out has been very very instructive for me. Thank you, Giuseppe -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general