PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized_spgist_compress_nd()

PGDLLEXPORT Datum gserialized_spgist_compress_nd ( PG_FUNCTION_ARGS  )

Definition at line 597 of file gserialized_spgist_nd.c.

598 {
599  char gidxmem[GIDX_MAX_SIZE];
600  GIDX *result = (GIDX *)gidxmem;
601  long unsigned int i;
602 
603  POSTGIS_DEBUG(4, "[SPGIST] 'compress' function called");
604 
605  /* Input entry is null? Return NULL. */
606  if (PG_ARGISNULL(0))
607  {
608  POSTGIS_DEBUG(4, "[SPGIST] null entry (!?!)");
609  PG_RETURN_NULL();
610  }
611 
612  /* Is the bounding box valid (non-empty, non-infinite) ?
613  * If not, return NULL. */
614  if (gserialized_datum_get_gidx_p(PG_GETARG_DATUM(0), result) == LW_FAILURE)
615  {
616  POSTGIS_DEBUG(4, "[SPGIST] empty geometry!");
617  PG_RETURN_NULL();
618  }
619 
620  POSTGIS_DEBUGF(4, "[SPGIST] got GIDX: %s", gidx_to_string(result));
621 
622  /* Check all the dimensions for finite values.
623  * If not, use the "unknown" GIDX as a key */
624  for (i = 0; i < GIDX_NDIMS(result); i++)
625  {
626  if (!isfinite(GIDX_GET_MAX(result, i)) || !isfinite(GIDX_GET_MIN(result, i)))
627  {
628  gidx_set_unknown(result);
629  PG_RETURN_POINTER(result);
630  }
631  }
632 
633  /* Ensure bounding box has minimums below maximums. */
634  gidx_validate(result);
635 
636  /* Return GIDX. */
637  PG_RETURN_POINTER(gidx_copy(result));
638 }
void gidx_set_unknown(GIDX *a)
GIDX * gidx_copy(GIDX *b)
void gidx_validate(GIDX *b)
#define LW_FAILURE
Definition: liblwgeom.h:110

References gidx_copy(), gidx_set_unknown(), gidx_validate(), and LW_FAILURE.

Here is the call graph for this function: