Re: BUG #19110: the order of elements in a json object in database is different then the order of elements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: tal(dot)tabakman(at)foretellix(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19110: the order of elements in a json object in database is different then the order of elements
Date: 2025-11-11 15:16:03
Message-ID: 2183808.1762874163@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Vik Fearing 2025-11-11 15:16:06 Re: BUG #19106: Potential regression with CTE materialization planning in Postgres 18
Previous Message PG Bug reporting form 2025-11-11 14:26:34 BUG #19110: the order of elements in a json object in database is different then the order of elements