pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedTwo PostgreSQL instances returning different output for same query
6+ messages / 5 participants
[nested] [flat]
* Two PostgreSQL instances returning different output for same query
@ 2022-08-30 15:21 John Scalia <jayknowsunix@gmail.com>
2022-08-30 15:28 ` Re: Two PostgreSQL instances returning different output for same query David G. Johnston <david.g.johnston@gmail.com>
2022-08-30 15:49 ` Re: Two PostgreSQL instances returning different output for same query hubert depesz lubaczewski <depesz@depesz.com>
2022-08-30 15:50 ` Re: Two PostgreSQL instances returning different output for same query Ron <ronljohnsonjr@gmail.com>
2022-08-30 16:06 ` Re: Two PostgreSQL instances returning different output for same query Tom Lane <tgl@sss.pgh.pa.us>
2022-08-30 16:20 ` Re: Two PostgreSQL instances returning different output for same query hubert depesz lubaczewski <depesz@depesz.com>
0 siblings, 5 replies; 6+ messages in thread
From: John Scalia @ 2022-08-30 15:21 UTC (permalink / raw)
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
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.
Running the query on the DEV instance produces
to_jsonb
———————————-
{“type”: “Point”, “coordinates”: [-106.54569, 31.82908]}
While running it on the UAT instance produces
to_jsonb
—————————————
“0101000020E610009000000000000000“
If I remove the to_jsonb() so the query becomes SELECT geom FROM addresses; both output the same very long string that the UAT instance produces for the to_jsonb() output. So UAT does not seem to be processing the to_jsonb.
I’m thinking that there might be a GUC controlling the output format, but I can’t seem to find any references for one.
Any ideas?
Jay
Sent from my iPad
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Two PostgreSQL instances returning different output for same query
2022-08-30 15:21 Two PostgreSQL instances returning different output for same query John Scalia <jayknowsunix@gmail.com>
@ 2022-08-30 15:28 ` David G. Johnston <david.g.johnston@gmail.com>
4 siblings, 0 replies; 6+ messages in thread
From: David G. Johnston @ 2022-08-30 15:28 UTC (permalink / raw)
To: John Scalia <jayknowsunix@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
On Tue, Aug 30, 2022 at 8:21 AM John Scalia <jayknowsunix@gmail.com> wrote:
> The query is a simple: SELECT to_jsonb(geom) FROM addresses LIMIT 1;
>
>
What is the point of LIMIT 1?
David J.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Two PostgreSQL instances returning different output for same query
2022-08-30 15:21 Two PostgreSQL instances returning different output for same query John Scalia <jayknowsunix@gmail.com>
@ 2022-08-30 15:49 ` hubert depesz lubaczewski <depesz@depesz.com>
4 siblings, 0 replies; 6+ messages in thread
From: hubert depesz lubaczewski @ 2022-08-30 15:49 UTC (permalink / raw)
To: John Scalia <jayknowsunix@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
On Tue, Aug 30, 2022 at 11:21:26AM -0400, John Scalia wrote:
> 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.
>
> Running the query on the DEV instance produces
> to_jsonb
> ———————————-
> {“type”: “Point”, “coordinates”: [-106.54569, 31.82908]}
>
> While running it on the UAT instance produces
> to_jsonb
> —————————————
> “0101000020E610009000000000000000“
Check installed extensions, and their versions in both dbs.
Best regards,
depesz
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Two PostgreSQL instances returning different output for same query
2022-08-30 15:21 Two PostgreSQL instances returning different output for same query John Scalia <jayknowsunix@gmail.com>
@ 2022-08-30 15:50 ` Ron <ronljohnsonjr@gmail.com>
4 siblings, 0 replies; 6+ messages in thread
From: Ron @ 2022-08-30 15:50 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
On 8/30/22 10:21, John Scalia wrote:
> 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.
Obligatory "why are you using 12.3 when 12.11 is the latest?" Upgrading
takes all of 15 minutes.
> The query is a simple: SELECT to_jsonb(geom) FROM addresses LIMIT 1;
Are you *sure* that they are the same record? (I *always* use ORDER
BY**with**"LIMIT 1" when comparing records.)
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Two PostgreSQL instances returning different output for same query
2022-08-30 15:21 Two PostgreSQL instances returning different output for same query John Scalia <jayknowsunix@gmail.com>
@ 2022-08-30 16:06 ` Tom Lane <tgl@sss.pgh.pa.us>
4 siblings, 0 replies; 6+ messages in thread
From: Tom Lane @ 2022-08-30 16:06 UTC (permalink / raw)
To: John Scalia <jayknowsunix@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Two PostgreSQL instances returning different output for same query
2022-08-30 15:21 Two PostgreSQL instances returning different output for same query John Scalia <jayknowsunix@gmail.com>
@ 2022-08-30 16:20 ` hubert depesz lubaczewski <depesz@depesz.com>
4 siblings, 0 replies; 6+ messages in thread
From: hubert depesz lubaczewski @ 2022-08-30 16:20 UTC (permalink / raw)
To: John Scalia <jayknowsunix@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
On Tue, Aug 30, 2022 at 11:21:26AM -0400, John Scalia wrote:
> 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.
Changelog for postgis 3.0.0 shows:
3687, Casts json(geometry) and jsonb(geometry) for implicit GeoJSON generation (Paul Ramsey)
looks to be very related.
Best regards,
depesz
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2022-08-30 16:20 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 15:21 Two PostgreSQL instances returning different output for same query John Scalia <jayknowsunix@gmail.com>
2022-08-30 15:28 ` David G. Johnston <david.g.johnston@gmail.com>
2022-08-30 15:49 ` hubert depesz lubaczewski <depesz@depesz.com>
2022-08-30 15:50 ` Ron <ronljohnsonjr@gmail.com>
2022-08-30 16:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-08-30 16:20 ` hubert depesz lubaczewski <depesz@depesz.com>
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