【发布时间】:2022-01-12 10:32:33
【问题描述】:
为什么两个 Postgres/PostGIS 安装的相同查询的结果会不同?
我在一个通用主机(Windows 上的 VMWare)中有两个 Linux VM(Centos 9、Postgres 12.8;Kubuntu 20.04、postgres 12.9),每个都运行带有 PostGIS 扩展的 Postgres。 在两者上使用相同的 testdata 运行回归测试会给出不同的结果: ST_AsText 舍入不同,除非我限制精度(例如 ST_AsText(_ , 13) 而不是默认的 ST_AsText(_ , 15)。
我知道精确到小数点后 13 位就足够了。不过,我想了解安装的哪些特性会导致观察到的差异。
CentOS:
psql (12.4, server 12.8)
Type "help" for help.
testdb=> select p, ST_AsText(p, 15) from (select ST_PointN(path_geogr::geometry, 18) as p from track where id=4) as _;
p | st_astext
----------------------------------------------------+------------------------------------------
0101000020E6100000000080C731971C400000B8488E754940 | POINT(7.14765083044767 50.9184046648443)
(1 row)
Kubuntu:
psql (12.4, server 12.9 (Ubuntu 12.9-2.pgdg20.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
testdb=> select p, ST_AsText(p, 15) from (select ST_PointN(path_geogr::geometry, 18) as p from track where id=4) as _;
p | st_astext
----------------------------------------------------+---------------------------------------------
0101000020E6100000000080C731971C400000B8488E754940 | POINT(7.147650830447674 50.918404664844275)
(1 row)
【问题讨论】:
-
如上所述:在 kubuntu 上运行 postgres 12.9,在 centos 12.8 上
标签: postgresql rounding postgis