Re: Re: Turn a json column into a table

From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Re: Turn a json column into a table
Date: 2022-02-19 22:03:12
Message-ID: CA+i5JwbFt15pUb6DvnNfn2hy1VdfK27KHKBxv0J+DzyhKivokA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 15 Feb 2022 at 08:09, Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Shaozhong SHI 2022-02-19 22:40:04 Re: Re: Re: Turn a json column into a table
Previous Message Shaozhong SHI 2022-02-17 22:38:41 Advancing the capability of Postgres and PostGIS