Re: Using relations in the SELECT part

From: Giuseppe Sacco <giuseppe(at)eppesuigoccas(dot)homedns(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Using relations in the SELECT part
Date: 2017-03-30 07:25:20
Message-ID: 1490858720.3316.5.camel@eppesuigoccas.homedns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2017-03-30 07:46:51 Re: Unexpected interval comparison
Previous Message Agarwal, Prateek 2017-03-30 06:59:24 Re: Issue in autovacuum