#4979 closed defect (worksforme)
There are still problems with geographies
Reported by: | ezimanyi | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.1.4 |
Component: | postgis | Version: | 2.5.x -- EOL |
Keywords: | Cc: |
Description
esteban@DESKTOP-9FBND60:~/src/MobilityDB/test/point/data$ psql -p 5433 test_pg3 psql (13.2) Type "help" for help. test_pg3=# create extension postgis; CREATE EXTENSION test_pg3=# select postgis_full_version(); postgis_full_version ------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------- POSTGIS="3.1.2dev b02ee95" [EXTENSION] PGSQL="130" GEOS="3.8.0-CAPI-1.13.1 " PROJ="6.3.1" LIBXML="2.9.10" LIBJSON="0.13 .1" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" (1 row) test_pg3=# select geography 'Point empty'; ERROR: lwgeom_set_geodetic: unsupported geom type: Unknown LINE 1: select geography 'Point empty'; ^ test_pg3=# select geography 'Linestring empty'; ERROR: lwgeom_set_geodetic: unsupported geom type: Unknown LINE 1: select geography 'Linestring empty'; ^ test_pg3=# select geography 'Polygon empty'; ERROR: lwgeom_set_geodetic: unsupported geom type: Unknown LINE 1: select geography 'Polygon empty';
Change History (6)
comment:2 by , 3 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
ezimanyi,
Can you upgrade to the latest PostGIS 3.1.2.. PostGIS 3.1.2 was released already so you shouldn't be running a dev version or if dev it should be PostGIS 3.1.3dev. I can't replicate the above issue on my 3.1.2 or 3.1.3dev
On mine:
POSTGIS="3.1.2 3.1.2" [EXTENSION] PGSQL="130" GEOS="3.9.1-CAPI-1.14.1" SFCGAL="1.3.8" PROJ="7.1.1" GDAL="GDAL 3.2.3, released 2021/04/27" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER
select geography 'Point empty';
returns:
0101000020E6100000000000000000F87F000000000000F87F
select geography 'Point(1 1)';
Returns:
0101000020E6100000000000000000F03F000000000000F03F
I'm going to close this out, but feel free to reopen if you still have issue. It's possible it is an issue with proj thought I doubt it as I don't think that part of the code uses proj.
comment:3 by , 3 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
I have still the same problems :-( I have just downloaded version 3.1.3 from the link Regina told me, and do the following steps
cd postgis-3.1.3/ chmod +x configure ./configure make sudo make install
The problem is still there
esteban@DESKTOP-9FBND60:~/src/MobilityDB/build$ dropdb -p 5433 test_pg3 esteban@DESKTOP-9FBND60:~/src/MobilityDB/build$ createdb -p 5433 test_pg3 esteban@DESKTOP-9FBND60:~/src/MobilityDB/build$ psql -p 5433 test_pg3 psql (13.2) Type "help" for help. test_pg3=# create extension postgis; CREATE EXTENSION test_pg3=# select geography 'Point(1 1)'; 2021-08-22 09:46:06.943 CEST [19008] ERROR: lwgeom_set_geodetic: unsupported geom type: Unknown at character 18 2021-08-22 09:46:06.943 CEST [19008] STATEMENT: select geography 'Point(1 1)'; ERROR: lwgeom_set_geodetic: unsupported geom type: Unknown LINE 1: select geography 'Point(1 1)'; ^ test_pg3=# select postgis_full_version(); postgis_full_version ------------------------------------------------------------------------------------------------------------------------ ---------------------------------------------- POSTGIS="3.1.3 008d2db" [EXTENSION] PGSQL="130" GEOS="3.8.0-CAPI-1.13.1 " PROJ="6.3.1" LIBXML="2.9.10" LIBJSON="0.13.1" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" (1 row) test_pg3=#
comment:4 by , 3 years ago
Summary: | There are still problems with empty geographies → There are still problems with geographies |
---|
comment:5 by , 3 years ago
When I execute
test_pg3=# select postgis_full_version(); postgis_full_version ------------------------------------------------------------------------------------------------------------------------ ---------------------------------------------- POSTGIS="3.1.3 008d2db" [EXTENSION] PGSQL="130" GEOS="3.8.0-CAPI-1.13.1 " PROJ="6.3.1" LIBXML="2.9.10" LIBJSON="0.13.1" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" (1 row) test_pg3=# select geography 'Point(1 1)';
the trace of the problem with gdb is as follows
esteban@DESKTOP-9FBND60:~/src/postgis-3.1.3$ sudo gdb -p 19989 GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> [...] (gdb) b geography_in Breakpoint 1 at 0x7f58a5863b5a: geography_in. (2 locations) (gdb) c Continuing. Breakpoint 1, geography_in (fcinfo=0x560f00000001) at geography_inout.c:138 138 { (gdb) n 139 char *str = PG_GETARG_CSTRING(0); (gdb) 141 int32 geog_typmod = -1; (gdb) 143 LWGEOM *lwgeom = NULL; (gdb) 144 GSERIALIZED *g_ser = NULL; (gdb) 146 if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) ) { (gdb) 147 geog_typmod = PG_GETARG_INT32(2); (gdb) 150 lwgeom_parser_result_init(&lwg_parser_result); (gdb) 153 if ( str[0] == '\0' ) (gdb) 157 if ( str[0] == '0' ) (gdb) 168 if ( lwgeom_parse_wkt(&lwg_parser_result, str, LW_PARSER_CHECK_ALL) == LW_FAILURE ) (gdb) 171 lwgeom = lwg_parser_result.geom; (gdb) 175 srid_check_latlong(lwgeom->srid); (gdb) p *lwgeom $3 = {bbox = 0x0, data = 0x560fce6f55d8, srid = 0, flags = 0, type = 1 '\001', pad = ""} (gdb) p *((LWPOINT *)lwgeom) $4 = {type = 0 '\000', flags = 0 '\000', bbox = 0x560fce6f55d8, srid = 0, point = 0x0} (gdb) p sizeof(LWGEOM) $5 = 24 (gdb) p sizeof(LWPOINT) $6 = 32 (gdb) n 178 g_ser = gserialized_geography_from_lwgeom(lwgeom, geog_typmod); (gdb) s gserialized_geography_from_lwgeom (lwgeom=0xa58fe637, geog_typmod=1) at geography_inout.c:90 90 { (gdb) n 91 GSERIALIZED *g_ser = NULL; (gdb) 94 lwgeom_set_geodetic(lwgeom, true); (gdb) s lwgeom_set_geodetic (geom=0x560fce6f55c0, value=32765) at lwgeom.c:953 953 { (gdb) n 960 FLAGS_SET_GEODETIC(geom->flags, value); (gdb) p *geom $7 = {type = 0 '\000', flags = 0 '\000', bbox = 0x560fce6f55d8, srid = 0, data = 0x0} (gdb) n 961 if ( geom->bbox ) (gdb) 962 FLAGS_SET_GEODETIC(geom->bbox->flags, value); (gdb) 964 switch(geom->type) (gdb) 990 lwerror("lwgeom_set_geodetic: unsupported geom type: %s", lwtype_name(geom->type)); (gdb)
The problem are the sizes of LWGEOM vs LWPOINT reported (24 vs 32). Therefore, a previous installation of PostGIS 2.5.5 is conflicting with the new one PostGIS 3.1.3 as can be seen in the definitions from PostGIS 2.5.5 below
/* POINTYPE */ typedef struct { uint8_t type; /* POINTTYPE */ uint8_t flags; GBOX *bbox; int32_t srid; POINTARRAY *point; /* hide 2d/3d (this will be an array of 1 point) */ } LWPOINT; /* "light-weight point" */
which are conflicting with the new ones from PostGIS 3.1.3
/* POINTYPE */ typedef struct { GBOX *bbox; POINTARRAY *point; /* hide 2d/3d (this will be an array of 1 point) */ int32_t srid; lwflags_t flags; uint8_t type; /* POINTTYPE */ char pad[1]; /* Padding to 24 bytes (unused) */ } LWPOINT; /* "light-weight point" */
After removing all traces from PostGIS 2.5.5 in my system it finally works.
Maybe the installation for PostGIS 3.x should remove the old versions 2.5.x installed in the system.
comment:6 by , 3 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
We have no contol over what packagers do. I think most no longer remove old releases cause then it would be difficult for people to pg_upgrade from say 2.5 to 3 or 3.1. Note that in the case of pg_upgrade, which many people use these days, both a 2.5 and 3. lib file must exist in the PG12 if you are say upgrading from PG11 to PG12.
I'll test on windows to make sure it's not an issue there, but I doubt it is because at least as far as windows is concerned I statically include liblwgeom in PostGIS 2.5, 2.4 with one of the reasons being for this kind of thing. Around 3.0/3.1 we made this the official thing by not exporting liblwgeom anymore. Before debian would have a patch to undo this and then we saw these kinds of issues with liblwgeom from a previous release latching on to a newer PostGIS.
Actually, maybe the problem is with all geographies