Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIq6L-00GPOa-16 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Nov 2025 15:16:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIq6I-006XJS-2v for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Nov 2025 15:16:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIq6I-006XJJ-25 for pgsql-bugs@lists.postgresql.org; Tue, 11 Nov 2025 15:16:06 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIq6H-006ZEB-01 for pgsql-bugs@lists.postgresql.org; Tue, 11 Nov 2025 15:16:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 5ABFG3x52183809; Tue, 11 Nov 2025 10:16:03 -0500 From: Tom Lane To: tal.tabakman@foretellix.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19110: the order of elements in a json object in database is different then the order of elements In-reply-to: <19110-dffefa888c44b48f@postgresql.org> References: <19110-dffefa888c44b48f@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 11 Nov 2025 14:26:34 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2183807.1762874163.1@sss.pgh.pa.us> Date: Tue, 11 Nov 2025 10:16:03 -0500 Message-ID: <2183808.1762874163@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > This hash map is stored as a json object under a column defined as a json > column (and not jsonb) > what we are noticing is that when we send the relevant object from our > application to postgres and fetch it back (using update and select queries > respectivally) , the order of elemenet in the hash map is changing which > causes a problem in our end. The only way this could possibly be happening on the Postgres server side is if the value is being cast to jsonb on its way to the table. I'd check issues like how the prepared statement's parameter is declared. If you are going through JDBC or another client-side stack, it's possible that that is substituting jsonb for json in the command issued to the server. You might need to pretend that the parameter is plain text to avoid that. regards, tom lane