pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Tony Shelver <tshelver@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: JSONB order?
Date: Thu, 5 Nov 2020 09:27:43 -0700
Message-ID: <BCF7B6B0-B8E3-4B63-A75F-3C423B16111A@gmail.com> (raw)
In-Reply-To: <CAG0dhZCROB_8usnZ_WytoVrYdvRYn3GRTYQuXPY15-ybcya17w@mail.gmail.com>
References: <CAG0dhZD8tAuSe3mQQ1sUfj92njUgHQ39sht4yNamkJfZx386gg@mail.gmail.com>
	<85B65AB1-BD99-4F15-9B33-86F2B00EA106@thebuild.com>
	<CAG0dhZAYGKsiYf5qHKbE6H-+f3Pw3tWdcBywc3sQ-k3_uL7mPA@mail.gmail.com>
	<CAG0dhZCROB_8usnZ_WytoVrYdvRYn3GRTYQuXPY15-ybcya17w@mail.gmail.com>



> On Nov 5, 2020, at 8:45 AM, Tony Shelver <tshelver@gmail.com> wrote:
> 
> 
> 
> ---------- Forwarded message ---------
> From: Tony Shelver <tshelver@gmail.com <mailto:tshelver@gmail.com>>
> Date: Thu, 5 Nov 2020 at 17:45
> Subject: Re: JSONB order?
> To: Christophe Pettus <xof@thebuild.com <mailto:xof@thebuild.com>>
> 
> 
> 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.
> 
> 
> 
> On Thu, 5 Nov 2020 at 17:40, Christophe Pettus <xof@thebuild.com <mailto:xof@thebuild.com>> wrote:
> 
> 
> > On Nov 5, 2020, at 07:34, Tony Shelver <tshelver@gmail.com <mailto:tshelver@gmail.com>> wrote:
> > But...  seen above, the order gets mixed up.
> > 
> > Any ideas?
> 
> JSON objects, like Python dicts, are not automatically ordered by key.  Once you move from the column space to the JSON object space, you can't rely on the object keys being in a consistent order.
> 
> You'll want to have a step when ingesting the JSON object into a report that lines up the key values appropriately with the right presentation in the report.
> --
> -- Christophe Pettus
>    xof@thebuild.com <mailto:xof@thebuild.com>
> 

Sounds like you’ll need a separate mechanism for maintaining versions of the forms and which headers represent the same data concept.  Always access data via canonical header translated to current form.

view thread (9+ messages)  latest in thread

Message-ID: <BCF7B6B0-B8E3-4B63-A75F-3C423B16111A@gmail.com>
Permalink:  ../BCF7B6B0-B8E3-4B63-A75F-3C423B16111A@gmail.com/
Also on:    postgresql.org/message-id/BCF7B6B0-B8E3-4B63-A75F-3C423B16111A@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robjsargent@gmail.com, tshelver@gmail.com
  Subject: Re: JSONB order?
  In-Reply-To: <BCF7B6B0-B8E3-4B63-A75F-3C423B16111A@gmail.com>
  References: <CAG0dhZD8tAuSe3mQQ1sUfj92njUgHQ39sht4yNamkJfZx386gg@mail.gmail.com> <85B65AB1-BD99-4F15-9B33-86F2B00EA106@thebuild.com> <CAG0dhZAYGKsiYf5qHKbE6H-+f3Pw3tWdcBywc3sQ-k3_uL7mPA@mail.gmail.com> <CAG0dhZCROB_8usnZ_WytoVrYdvRYn3GRTYQuXPY15-ybcya17w@mail.gmail.com> <BCF7B6B0-B8E3-4B63-A75F-3C423B16111A@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox