Re: Query fails when SRFs are part of FROM clause (Commit id: 69f4b9c85f)

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Query fails when SRFs are part of FROM clause (Commit id: 69f4b9c85f)
Date: 2017-01-27 22:16:38
Message-ID: CAKFQuwapfoxHYsHBygGHauV22CcHiRBYC5MA6zsKFC5XgKXqbg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 27, 2017 at 3:13 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> In any case the more idiomatic way of writing your query these days (since
> 9.4 came out) is:
>
> SELECT *
> FROM pg_constraint pc
> LEFT JOIN LATERAL generate_series(1, case when contype in ('f','p','u')
> then array_upper(pc.conkey, 1) else 0 end) gs ON true;
>
>
Supposedly ​should work back to 9.3​, mis-remembered when LATERAL was
released.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-01-27 22:23:51 Re: Typo in comment in postgres_fdw.c
Previous Message David G. Johnston 2017-01-27 22:13:24 Re: Query fails when SRFs are part of FROM clause (Commit id: 69f4b9c85f)