[postgis-devel] PostGIS 3 and MobilityDB

Esteban Zimanyi esteban.zimanyi at ulb.be
Fri Jul 9 01:06:43 PDT 2021


Dear Regina

Many thanks for restarting the issue of detecting PostgreSQL and PostGIS
versions, we will look into it.

Concerning C compatibility, we already need to cope with this for
PostgreSQL. I have collected below some pieces of code we need to put to
cope with various PostgreSQL versions (this is not exhaustive). There is no
problem for us to do similar things for changes in PostGIS.

#if MOBDB_PGSQL_VERSION < 110000
  pq_sendint(buf, (uint32) ts->count, 4);
#else
  pq_sendint32(buf, ts->count);
#endif

#if MOBDB_PGSQL_VERSION < 130000
#include <access/tuptoaster.h>
#else
#include <access/heaptoast.h>
#endif
#if MOBDB_PGSQL_VERSION < 110000
#include <catalog/pg_collation.h>
#include <catalog/pg_operator.h>
#else
#include <catalog/pg_collation_d.h>
#include <catalog/pg_operator_d.h>
#endif

#if MOBDB_PGSQL_VERSION >= 120000
#include <utils/float.h>
#endif

#if MOBDB_PGSQL_VERSION < 110000
  RangeType *range = PG_GETARG_RANGE(1);
#else
  RangeType *range = PG_GETARG_RANGE_P(1);
#endif

#if MOBDB_PGSQL_VERSION < 140000
/**
 * Returns the union of the range values. If strict is true, it is an error
 * that the two input ranges are not adjacent or overlapping.
 *
 * @note Function copied verbatim from rangetypes.c since it is static
before
 * PostgreSQL version 14.
 */
static RangeType *
range_union_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2,
  bool strict)
{
  [...]
}
#endif

#if MOBDB_PGSQL_VERSION < 110000
PG_FUNCTION_INFO_V1(temporal_gist_decompress);
/**
 * GiST decompress method for temporal values (result in a period)
 *
 * The decompress method is optional after PostgreSQL version 11
 */
PGDLLEXPORT Datum
temporal_gist_decompress(PG_FUNCTION_ARGS)
{
  GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
  PG_RETURN_POINTER(entry);
}
#endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20210709/3c22a1a3/attachment.html>


More information about the postgis-devel mailing list