pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: John Scalia <jayknowsunix@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Two PostgreSQL instances returning different output for same query
Date: Tue, 30 Aug 2022 12:06:11 -0400
Message-ID: <3678519.1661875571@sss.pgh.pa.us> (raw)
In-Reply-To: <C1D9F597-B620-43B4-8561-49A8725BCBA1@gmail.com>
References: <C1D9F597-B620-43B4-8561-49A8725BCBA1@gmail.com>

John Scalia <jayknowsunix@gmail.com> writes:
> I’m a bit stumped on this one. For one of my application teams both their DEV instance and UAT instance are running pg version 12.3 in AWS RDS, and I’ve used the same psql version 13.4.
> The query is a simple:  SELECT to_jsonb(geom) FROM addresses LIMIT 1;

> On both databases the geom field is of data type geometry from postgis, but the two dbs are running different versions of Postgis. DEV is 3.0.2 while UAT is 2.5.2, but I don’t think this is causing the issue.

I think you're being far too hasty to reject a highly probable
explanation.  Consult the Postgis release notes to see if they
changed anything about casting-to-JSON between those two releases.

A quick look at to_jsonb's innards shows that for a non-core input type,
it will use the type's cast to JSON if there is one, while if there is
not, it will just run the type's output function and call the result a
JSON string.  This seems to fit quite well with the results you show.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <3678519.1661875571@sss.pgh.pa.us>
Permalink:  ../3678519.1661875571@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3678519.1661875571@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jayknowsunix@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Two PostgreSQL instances returning different output for same query
  In-Reply-To: <3678519.1661875571@sss.pgh.pa.us>

* 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