Re: JSONB order? - Mailing list pgsql-general

From Christophe Pettus
Subject Re: JSONB order?
Date
Msg-id 2871D4AD-7885-40BF-86A7-90E321C4E3AF@thebuild.com
Whole thread Raw
In response to Fwd: JSONB order?  (Tony Shelver <tshelver@gmail.com>)
List pgsql-general

> On Nov 5, 2020, at 07:45, Tony Shelver <tshelver@gmail.com> wrote:
> Thanks Christophe, that's what I thought.
> Just seemed weird that they were 'disordered' in exactly the same way every time.
>
> FYI, as of Python 3.7, dicts are ordered.
>
> The problem is that we are possibly going to have many versions of these forms with slightly differing keys, which
willbe a pain to order in some hard coded way. 

As Magnus noted, you can use JSON instead of JSONB.  JSON is basically a text blob with a syntax check wrapper around
it,so it will be order-stable once created.  (If you run it through a JSONB-expecting function, then the ordering may
changeagain.)  It's less efficient to operate on than JSONB, but that might be OK for your purposes. 

--
-- Christophe Pettus
   xof@thebuild.com




pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: precautions/prerequisites to take for specific table
Next
From: "David G. Johnston"
Date:
Subject: Re: JSONB order?