From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(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-24 18:55:11 |
Message-ID: | 20200924185511.GC22807@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
On Sun, Sep 20, 2020 at 02:14:00PM -0400, Tom Lane wrote:
> I wrote:
> > 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
>
> Meh, I was too hasty and pushed "send" with a broken example. Better
>
> =# select * from rows from (json_to_recordset('[{"a":1,"b":"foo"},{"a":"2","b":"bar"}]') as (a int, b text), generate_series(1,3)) as x(p,q,s);
> p | q | s
> ---+-----+---
> 1 | foo | 1
> 2 | bar | 2
> | | 3
> (3 rows)
Yes, this is very helpful. I was afraid the JSON would overwhelm the
example, but this looks good. I wrote the attached doc patch which I
think improves this. I plan to apply it to all supported versions.
--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
Attachment | Content-Type | Size |
---|---|---|
row.diff | text/x-diff | 2.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-09-24 19:05:24 | Re: Please provide examples of rows from |
Previous Message | Bruce Momjian | 2020-09-24 18:52:19 | Re: Please provide examples of rows from |