Re: Extracting data from jsonb array?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Steve Baldwin <steve(dot)baldwin(at)gmail(dot)com>, Rob Sargent <robjsargent(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Extracting data from jsonb array?
Date: 2020-12-08 05:41:51
Message-ID: CAKFQuwZ92os34XWkHjM9i8mb2bZeLf+RD+p73+0+xAFL56EuNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, December 7, 2020, Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> wrote:

>
> There's one last piece of this query I'm clearly not getting though.
> Where it says:
>
> from foo as f, jsonb_to_recordset(js) as t(key2 text)
>
> what is actually going on there? I keep reading this as a table foo (f)
> cross-joined to a table created by jsonb_to_recordset (t). But that
> doesn't seem right, because rows from t are only joining with matching rows
> from f, rather than all of them. Is there some unspoken implicit logic
> going on here, or something else entirely that is going over my head?
>

That is the lateral join.

https://www.postgresql.org/docs/current/sql-select.html

Read the section under from, join, lateral.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-12-08 05:54:06 Re: Extracting data from jsonb array?
Previous Message Ken Tanzer 2020-12-08 05:38:21 Re: Extracting data from jsonb array?