Re: Re: Turn a json column into a table - Mailing list pgsql-sql

From Shaozhong SHI
Subject Re: Re: Turn a json column into a table
Date
Msg-id CA+i5JwbFt15pUb6DvnNfn2hy1VdfK27KHKBxv0J+DzyhKivokA@mail.gmail.com
Whole thread Raw
In response to Aw: Re: Turn a json column into a table  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-sql


On Tue, 15 Feb 2022 at 08:09, Karsten Hilbert <Karsten.Hilbert@gmx.net> wrote:
Hi Ion,

> it seems (json_to_record, jsonb_to_record) may help in this use case.
> https://www.postgresql.org/docs/9.4/functions-json.html

json_to_record seems promising. Is there any excellent Postgresql example ?

Karsten


Hi, Karsten
I tried the folowing;
SELECT x.* FROM structures.str_fts_compoundstructure t, json_to_record(properties) AS x(a_key text, b_key text, theme text, changetype text); 
There are two similar fields, a_key, b_key ---identifiers.

But, a_key came out properly, but b_key came out all null.  Frustrating.

Regards,

David

pgsql-sql by date:

Previous
From: Shaozhong SHI
Date:
Subject: Advancing the capability of Postgres and PostGIS
Next
From: Shaozhong SHI
Date:
Subject: Re: Re: Re: Turn a json column into a table