Search Postgresql Archives

Re: JSONB order?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Nov 5, 2020, at 07:45, Tony Shelver <tshelver@xxxxxxxxx> 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 will be 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 change again.)  It's less efficient to operate on than JSONB, but that might be OK for your purposes.

--
-- Christophe Pettus
   xof@xxxxxxxxxxxx







[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux