Re: Please provide examples of rows from

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Guyren Howe <guyren(at)gmail(dot)com>, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Please provide examples of rows from
Date: 2020-09-20 14:57:14
Message-ID: 835988.1600613834@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> but doing this to illustrate ROWS FROM is going to be complex.

You're right that the only suitable core function is going to be
json[b]_to_recordset, but I don't see why you can't extend the
existing example for that. Something like

# select * from rows from (json_to_recordset('[{"a":1,"b":"foo"},{"a":"2","c":"bar"}]') as (x int, y text), generate_series(1,3)) as x(a,b,s) ;
a | b | s
---+-----+---
1 | foo | 1
2 | | 2
| | 3
(3 rows)

would illustrate all the principles.

regards, tom lane

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2020-09-20 18:09:13 Re: Please provide examples of rows from
Previous Message Bruce Momjian 2020-09-20 01:38:46 Re: Please provide examples of rows from