Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kahso-0001Vc-01 for pgsql-general@arkaria.postgresql.org; Thu, 05 Nov 2020 16:13:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kahsl-00014g-NQ for pgsql-general@arkaria.postgresql.org; Thu, 05 Nov 2020 16:13:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kahsl-00014Z-F2 for pgsql-general@lists.postgresql.org; Thu, 05 Nov 2020 16:13:03 +0000 Received: from smtp79.ord1d.emailsrvr.com ([184.106.54.79]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kahsh-0003nx-7N for pgsql-general@lists.postgresql.org; Thu, 05 Nov 2020 16:13:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=g001.emailsrvr.com; s=20190322-9u7zjiwi; t=1604592778; bh=rl18TYPtVUviB5PRrs5bmI6VyWYsmrNaxKT4brHPUOU=; h=Subject:From:Date:To:From; b=uk+homn5TYw7FjSGUqcmJRfDhEbj4BJ+rR8c0yarBa+7QBm+U5Zh7jBWJIwe6h4bh 15+rslciDtvOOirvLGCM2FBX2g28cdIbNabsTj2foELiwv4DA3poDJz1hKk8NIKHg4 tdRC0zhZ6qX2qDV+555/6TXZi9WjXCNY9GG+aikc= X-Auth-ID: xof@thebuild.com Received: by smtp2.relay.ord1d.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id D0973401E3; Thu, 5 Nov 2020 11:12:57 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.5\)) Subject: Re: JSONB order? From: Christophe Pettus In-Reply-To: Date: Thu, 5 Nov 2020 08:12:56 -0800 Cc: pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: <2871D4AD-7885-40BF-86A7-90E321C4E3AF@thebuild.com> References: <85B65AB1-BD99-4F15-9B33-86F2B00EA106@thebuild.com> To: Tony Shelver X-Mailer: Apple Mail (2.3445.9.5) X-Classification-ID: 4b1c00bc-56a8-43fd-8a4d-97525a6ba76b-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Nov 5, 2020, at 07:45, Tony Shelver wrote: > Thanks Christophe, that's what I thought. =20 > Just seemed weird that they were 'disordered' in exactly the same way = every time. >=20 > FYI, as of Python 3.7, dicts are ordered. >=20 > 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@thebuild.com