15 newval,
bool isnull,
int max_dims);
25 BrinDesc *bdesc = (BrinDesc *) PG_GETARG_POINTER(0);
26 BrinValues *column = (BrinValues *) PG_GETARG_POINTER(1);
27 Datum newval = PG_GETARG_DATUM(2);
28 bool isnull = PG_GETARG_BOOL(3);
39 BrinDesc *bdesc = (BrinDesc *) PG_GETARG_POINTER(0);
40 BrinValues *column = (BrinValues *) PG_GETARG_POINTER(1);
41 Datum newval = PG_GETARG_DATUM(2);
42 bool isnull = PG_GETARG_BOOL(3);
52 BrinDesc *bdesc = (BrinDesc *) PG_GETARG_POINTER(0);
53 BrinValues *column = (BrinValues *) PG_GETARG_POINTER(1);
54 Datum newval = PG_GETARG_DATUM(2);
55 bool isnull = PG_GETARG_BOOL(3);
63 BrinValues *column, Datum newval,
bool isnull,
int max_dims)
65 char gboxmem[GIDX_MAX_SIZE];
66 GIDX *gidx_geom, *gidx_key;
67 int dims_geom, dims_key, i;
69 Assert(max_dims <= GIDX_MAX_DIM);
77 if (column->bv_hasnulls)
78 PG_RETURN_BOOL(
false);
80 column->bv_hasnulls =
true;
88 if (!column->bv_allnulls &&
90 PG_RETURN_BOOL(
false);
93 gidx_geom = (GIDX *) gboxmem;
98 if (gserialized_datum_get_gidx_p(newval, gidx_geom) ==
LW_FAILURE)
110 PG_RETURN_BOOL(
true);
113 PG_RETURN_BOOL(
false);
120 elog(ERROR,
"Error while extracting the gidx from the geom");
125 dims_geom = GIDX_NDIMS(gidx_geom);
128 if (column->bv_allnulls)
137 if (dims_geom > max_dims)
143 SET_VARSIZE(gidx_geom, VARHDRSZ + max_dims * 2 *
sizeof(
float));
144 dims_geom = max_dims;
147 column->bv_values[
INCLUSION_UNION] = datumCopy((Datum) gidx_geom,
false,
148 GIDX_SIZE(dims_geom));
151 column->bv_allnulls =
false;
152 PG_RETURN_BOOL(
true);
156 dims_key = GIDX_NDIMS(gidx_key);
162 if (dims_key != dims_geom)
165 PG_RETURN_BOOL(
true);
170 PG_RETURN_BOOL(
false);
177 for ( i = 0; i < dims_key; i++ )
180 GIDX_SET_MIN(gidx_key, i,
181 Min(GIDX_GET_MIN(gidx_key,i),GIDX_GET_MIN(gidx_geom,i)));
183 GIDX_SET_MAX(gidx_key, i,
184 Max(GIDX_GET_MAX(gidx_key,i),GIDX_GET_MAX(gidx_geom,i)));
187 PG_RETURN_BOOL(
true);
bool is_gserialized_from_datum_empty(Datum the_datum)
Datum geom3d_brin_inclusion_add_value(PG_FUNCTION_ARGS)
Datum gidx_brin_inclusion_add_value(BrinDesc *bdesc, BrinValues *column, Datum newval, bool isnull, int max_dims)
Datum geom4d_brin_inclusion_add_value(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(geog_brin_inclusion_add_value)
Datum geog_brin_inclusion_add_value(PG_FUNCTION_ARGS)
bool gidx_contains(GIDX *a, GIDX *b)
#define INCLUSION_UNMERGEABLE
#define INCLUSION_CONTAINS_EMPTY