Re: Extension for PostgreSQL cast jsonb to hstore WIP

From: ShadowGhost <violin05082003(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Extension for PostgreSQL cast jsonb to hstore WIP
Date: 2024-04-02 15:43:09
Message-ID: CAOsjGuOdsJcBPkmSyBkT9xrokgFGsTx_r6eEVPrXFgG_r+pTng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At the moment, this cast supports only these structures, as it was enough
for my tasks:
{str:numeric}
{str:str}
{str:bool}
{str:null}
But it's a great idea and I'll think about implementing it.

вт, 2 апр. 2024 г. в 19:48, Andrew Dunstan <andrew(at)dunslane(dot)net>:

>
> On 2024-04-02 Tu 07:07, ShadowGhost wrote:
> > Hello all.
> > Recently, when working with the hstore and json formats, I came across
> > the fact that PostgreSQL has a cast of hstore to json, but there is no
> > reverse cast. I thought it might make it more difficult to work with
> > these formats. And I decided to make a cast json in the hstore. I used
> > the built-in jsonb structure to create it and may have introduced
> > methods to increase efficiency by 25% than converting the form
> > jsonb->text->hstore. Which of course is a good fact. I also wrote
> > regression tests to check the performance. I think this extension will
> > improve the work with jsonb and hstore in PostgreSQL.
> > If you've read this far, thank you for your interest, and I hope you
> > enjoy this extension!
> >
>
> One reason we don't have such a cast is that hstore has a flat
> structure, while json is tree structured, and it's not always an object
> / hash. Thus it's easy to reliably cast hstore to json but far less easy
> to cast json to hstore in the general case.
>
> What do you propose to do in the case or json consisting of scalars, or
> arrays, or with nested elements?
>
>
> cheers
>
>
> andrew
>
>
>
> --
> Andrew Dunstan
> EDB: https://www.enterprisedb.com
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-04-02 15:47:28 Re: Detoasting optionally to make Explain-Analyze less misleading
Previous Message Kartyshov Ivan 2024-04-02 15:21:34 Re: [HACKERS] make async slave to wait for lsn to be replayed