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

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>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 19989
Reading symbols from /usr/local/pgsql/13/bin/postgres...
Reading symbols from /lib/x86_64-linux-gnu/libpthread.so.0...
Reading symbols from /usr/lib/debug/.build-id/e5/4761f7b554d0fcc1562959665d93dffbebdaf0.debug...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Reading symbols from /lib/x86_64-linux-gnu/libxml2.so.2...
(No debugging symbols found in /lib/x86_64-linux-gnu/libxml2.so.2)
Reading symbols from /lib/x86_64-linux-gnu/librt.so.1...
Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/librt-2.31.so...
Reading symbols from /lib/x86_64-linux-gnu/libdl.so.2...
Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libdl-2.31.so...
Reading symbols from /lib/x86_64-linux-gnu/libm.so.6...
Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libm-2.31.so...
--Type <RET> for more, q to quit, c to continue without paging--c
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...
Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.31.so...
Reading symbols from /lib64/ld-linux-x86-64.so.2...
(No debugging symbols found in /lib64/ld-linux-x86-64.so.2)
Reading symbols from /lib/x86_64-linux-gnu/libicuuc.so.66...
(No debugging symbols found in /lib/x86_64-linux-gnu/libicuuc.so.66)
Reading symbols from /lib/x86_64-linux-gnu/libz.so.1...
(No debugging symbols found in /lib/x86_64-linux-gnu/libz.so.1)
Reading symbols from /lib/x86_64-linux-gnu/liblzma.so.5...
(No debugging symbols found in /lib/x86_64-linux-gnu/liblzma.so.5)
Reading symbols from /lib/x86_64-linux-gnu/libicudata.so.66...
(No debugging symbols found in /lib/x86_64-linux-gnu/libicudata.so.66)
Reading symbols from /lib/x86_64-linux-gnu/libstdc++.so.6...
(No debugging symbols found in /lib/x86_64-linux-gnu/libstdc++.so.6)
Reading symbols from /lib/x86_64-linux-gnu/libgcc_s.so.1...
(No debugging symbols found in /lib/x86_64-linux-gnu/libgcc_s.so.1)
Reading symbols from /usr/local/pgsql/13/lib/postgis-2.5.so...
Reading symbols from /lib/x86_64-linux-gnu/libgeos_c.so.1...
(No debugging symbols found in /lib/x86_64-linux-gnu/libgeos_c.so.1)
Reading symbols from /lib/x86_64-linux-gnu/libproj.so.15...
(No debugging symbols found in /lib/x86_64-linux-gnu/libproj.so.15)
Reading symbols from /lib/x86_64-linux-gnu/libjson-c.so.4...
(No debugging symbols found in /lib/x86_64-linux-gnu/libjson-c.so.4)
Reading symbols from /lib/x86_64-linux-gnu/libprotobuf-c.so.1...
(No debugging symbols found in /lib/x86_64-linux-gnu/libprotobuf-c.so.1)
Reading symbols from /lib/x86_64-linux-gnu/libgeos-3.8.0.so...
(No debugging symbols found in /lib/x86_64-linux-gnu/libgeos-3.8.0.so)
Reading symbols from /lib/x86_64-linux-gnu/libsqlite3.so.0...
(No debugging symbols found in /lib/x86_64-linux-gnu/libsqlite3.so.0)
Reading symbols from /lib/x86_64-linux-gnu/libnss_files.so.2...
Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnss_files-2.31.so...
Reading symbols from /usr/local/pgsql/13/lib/postgis-3.so...
0x00007f590d7eb58a in epoll_wait (epfd=4, events=0x560fce736e80, maxevents=1, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
30      ../sysdeps/unix/sysv/linux/epoll_wait.c: No such file or directory.
(gdb) b geography_in
Breakpoint 1 at 0x7f58a5863b5a: geography_in. (2 locations)
(gdb) p sizeof(LWGEOM)
$1 = 32
(gdb) p sizeof(LWPOINT)
$2 = 32
(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 at the beginning (both 32) and after (24 vs 32). Therefore, the definitions of liblwgeom.h from 2.5.5 that are still in my system at /usr/local/include from the previous installation from PostGIS 2.5.5

/* 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" */

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" */

Maybe the installation for PostGIS 3.x should remove the old versions 2.5.x installed in the system.

Version 2, 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.