Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#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:1 by ezimanyi, 3 years ago

Actually, maybe the problem is with all geographies

test_pg3=# select geography 'Point(1 1)';
ERROR:  lwgeom_set_geodetic: unsupported geom type: Unknown
LINE 1: select geography 'Point(1 1)';
                         ^
test_pg3=# select geography 'Linestring(1 1,2 2)';
ERROR:  lwgeom_set_geodetic: unsupported geom type: Unknown
LINE 1: select geography 'Linestring(1 1,2 2)';
                         ^
test_pg3=#
Last edited 3 years ago by ezimanyi (previous) (diff)

comment:2 by robe, 3 years ago

Resolution: worksforme
Status: newclosed

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.4dev

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.

Last edited 3 years ago by robe (previous) (diff)

comment:3 by ezimanyi, 3 years ago

Resolution: worksforme
Status: closedreopened

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 ezimanyi, 3 years ago

Summary: There are still problems with empty geographiesThere are still problems with geographies

comment:5 by ezimanyi, 3 years ago

When I execute

test_pg3=# select version();
                                               version
------------------------------------------------------------------------------------------------------
 PostgreSQL 13.2 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
(1 row)

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

Breakpoint 1, geography_in (fcinfo=0x55f900000001) 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 lwg_parser_result
$11 = {wkinput = 0x55f954a87f00 "Point(1 1)", serialized_lwgeom = 0x0, size = 0, geom = 0x55f954a88638, message = 0x0,
  errcode = 0, errlocation = 0, parser_check_flags = 7}
(gdb) p *lwgeom
$12 = {bbox = 0x0, data = 0x55f954a885b8, srid = 0, flags = 0, type = 1 '\001', pad = ""}
(gdb) p *((LWPOINT *)lwgeom)
$13 = {type = 0 '\000', flags = 0 '\000', bbox = 0x55f954a885b8, srid = 0, point = 0x0}
(gdb) p sizeof(LWGEOM)
$14 = 24
(gdb) p sizeof(LWPOINT)
$15 = 32
(gdb) n
178             g_ser = gserialized_geography_from_lwgeom(lwgeom, geog_typmod);
(gdb) s
gserialized_geography_from_lwgeom (lwgeom=0xc2ecd637, 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=0x55f954a885a0, value=32767) at lwgeom.c:953
953     {
(gdb) n
960             FLAGS_SET_GEODETIC(geom->flags, value);
(gdb)
961             if ( geom->bbox )
(gdb)
962                     FLAGS_SET_GEODETIC(geom->bbox->flags, value);
(gdb)
964             switch(geom->type)
(gdb) p geom->type
$16 = 0 '\000'
(gdb) p *geom
$17 = {type = 0 '\000', flags = 8 '\b', bbox = 0x55f954a885b8, srid = 0, data = 0x0}
(gdb)

What is strange are the sizes of LWGEOM vs LWPOINT reported (24 vs 32). Is there a problem with the alignment ? Is this a consequence of Ubuntu 20.04?

Version 1, edited 3 years ago by ezimanyi (previous) (next) (diff)

comment:6 by robe, 3 years ago

Resolution: worksforme
Status: reopenedclosed

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.

Last edited 3 years ago by robe (previous) (diff)
Note: See TracTickets for help on using tickets.