[Mobilitydb-dev] Fwd: Update about my experiments integrating PostGIS 3.1.3 and MobilityDB

Esteban Zimanyi esteban.zimanyi at ulb.be
Thu Aug 26 00:18:19 PDT 2021


Another example of difference in the regression tests between PostGIS 2.5.5
and 3.1.3 is as follows

SELECT disjoint(geometry 'Point(1 1)', tgeompoint '{[Point(1 1)@2000-01-01,
Point(2 2)@2000-01-02, Point(1 1)@2000-01-03],[Point(3 3)@2000-01-04,
Point(3 3)@2000-01-05]}');
- disjoint
-----------
- f
-(1 row)
-
+ERROR
+HINT:  Change argument 2: 'GEOMETRYCOLLECTION(LINESTRING(1 1,2 2,1
1),POINT(3 3))'
+CONTEXT:  SQL function "disjoint" statement 1

As can be seen, the function raises an error in PostGIS 2.5.5 and works
fine in PostGIS 3.1.3.

This kind of problem is managed in the regression tests by putting these
queries in a file whose name ends with the suffix '_pgis3'. CMake will not
run such tests if the installed PostGIS version is less than the major
version 3. We had similar issues for the SP-GiST indexes since they were
not usable before PostgreSQL version 11. Therefore, many files in the
regression tests end with the suffix '_pg11'. The CMake code for taking
care of this is as follows

foreach(file ${testfiles})
  get_filename_component(TESTNAME ${file} NAME_WE)
  set(DOTEST TRUE)
  if(${TESTNAME} MATCHES "_pg([0-9]+)")
    if(${POSTGRESQL_VERSION_MAYOR} LESS ${CMAKE_MATCH_1})
      message("Disabling test ${TESTNAME}")
      set(DOTEST FALSE)
    endif()
  endif()
  if(${TESTNAME} MATCHES "_pgis([0-9]+)")
    if(${POSTGIS_VERSION_MAYOR} LESS ${CMAKE_MATCH_1})
      message("Disabling test ${TESTNAME}")
      set(DOTEST FALSE)
    endif()
  endif()
  if(DOTEST)
    add_test(
      NAME ${TESTNAME}
      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/scripts
      COMMAND test.sh run_compare ${TESTNAME} ${file}
      )
    set_tests_properties(${TESTNAME} PROPERTIES
      FIXTURES_REQUIRED DB
      RESOURCE_LOCK DBLOCK)
  endif()
endforeach()

---------- Forwarded message ---------
From: Esteban Zimanyi <estebanzimanyi at gmail.com>
Date: Mon, Aug 23, 2021 at 6:58 PM
Subject: Re: Update about my experiments integrating PostGIS 3.1.3 and
MobilityDB
To: Vicky Vergara <vicky at georepublic.de>
Cc: <mobilitydb-dev at lists.osgeo.org>, Regina Obe <lr at pcorp.us>, Mahmoud
Sakr <m_attia_sakr at yahoo.com>, mohamed sayed <mohamed_bakli at aun.edu.eg>,
SCHOEMANS Maxime <Maxime.Schoemans at ulb.be>


I always solved that problem with the setPrecision functions
https://docs.mobilitydb.com/MobilityDB/develop/ch04s05.html#box_setPrecision
https://docs.mobilitydb.com/MobilityDB/develop/ch05s06.html#tpoint_setPrecision
You can find numerous setPrecision calls in all the tests. I needed to do
that when switching to PosgreSQL 13 because the output of the floating
point values were different between versions.

The difference now is that in PostGIS 3 they started using the ryu library
for output coordinates. The difference wrt the other tests is that we need
to output a geometry/geography as result of the trajectory function.

I have almost finished today to write a simple setPrecision function for
geometry/geography so that for example, the test
 SELECT ST_AsText(trajectory(tnpoint 'Npoint(1, 0.5)@2000-01-01'));
will be replaced by
 SELECT ST_AsText(setPrecision(trajectory(tnpoint 'Npoint(1,
0.5)@2000-01-01'), 6));
and this will solve the multiplatform variation for the tests.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mobilitydb-dev/attachments/20210826/2d4cab4a/attachment-0001.html>


More information about the Mobilitydb-dev mailing list