901{
902 SHARED_GSERIALIZED *shared_geom1 = ToastCacheGetGeometry(fcinfo, 0);
903 SHARED_GSERIALIZED *shared_geom2 = ToastCacheGetGeometry(fcinfo, 1);
904 const GSERIALIZED *geom1 = shared_gserialized_get(shared_geom1);
905 const GSERIALIZED *geom2 = shared_gserialized_get(shared_geom2);
906
907
908 text *imPtr = DatumGetTextP(DirectFunctionCall2(text_left,
909 PG_GETARG_DATUM(2), Int32GetDatum(9)));
910 char *im = text_to_cstring(imPtr);
912 uint32_t i;
913#if POSTGIS_GEOS_VERSION >= 31300
915#endif
916
918
919
920
921
922 for (i = 0; i < strlen(im); i++)
923 im[i] = toupper(im[i]);
924
926
927#if POSTGIS_GEOS_VERSION >= 31300
930 {
931 GEOSGeometry *g = NULL;
932 if (prep_cache->
gcache.argnum == 1)
933 {
935 }
936 else
937 {
939 imInvert(im);
940 }
941
944 GEOSGeom_destroy(g);
945 }
946 else
947#endif
948 {
949 GEOSGeometry *g1, *g2;
951 if (!g1)
HANDLE_GEOS_ERROR(
"First argument geometry could not be converted to GEOS");
953 if (!g2)
954 {
956 GEOSGeom_destroy(g1);
957 }
958 result = GEOSRelatePattern(g1, g2, im);
959 GEOSGeom_destroy(g1);
960 GEOSGeom_destroy(g2);
961 }
962
963 pfree(im);
965
967}
char result[OUT_DOUBLE_BUFFER_SIZE]
void gserialized_error_if_srid_mismatch(const GSERIALIZED *g1, const GSERIALIZED *g2, const char *funcname)
void lwgeom_geos_error(const char *fmt,...)
PrepGeomCache * GetPrepGeomCache(FunctionCallInfo fcinfo, SHARED_GSERIALIZED *g1, SHARED_GSERIALIZED *g2)
Given a couple potential geometries and a function call context, return a prepared structure for one ...
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)
const GEOSPreparedGeometry * prepared_geom