PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ parse_column_keys()

static void parse_column_keys ( mvt_agg_context ctx)
static

Definition at line 325 of file mvt.c.

326{
327 uint32_t i, natts;
328 bool geom_found = false;
329
330 POSTGIS_DEBUG(2, "parse_column_keys called");
331
333 natts = ctx->column_cache.tupdesc->natts;
334
335 ctx->column_cache.column_keys_index = palloc(sizeof(uint32_t) * natts);
336 ctx->column_cache.column_oid = palloc(sizeof(uint32_t) * natts);
337 ctx->column_cache.values = palloc(sizeof(Datum) * natts);
338 ctx->column_cache.nulls = palloc(sizeof(bool) * natts);
339
340 for (i = 0; i < natts; i++)
341 {
342 Oid typoid = getBaseType(TupleDescAttr(ctx->column_cache.tupdesc, i)->atttypid);
343 char *tkey = TupleDescAttr(ctx->column_cache.tupdesc, i)->attname.data;
344
345 ctx->column_cache.column_oid[i] = typoid;
346
347 if (typoid == JSONBOID)
348 {
350 continue;
351 }
352
353 if (ctx->geom_name == NULL)
354 {
355 if (!geom_found && typoid == postgis_oid(GEOMETRYOID))
356 {
357 ctx->geom_index = i;
358 geom_found = true;
359 continue;
360 }
361 }
362 else
363 {
364 if (!geom_found && strcmp(tkey, ctx->geom_name) == 0)
365 {
366 ctx->geom_index = i;
367 geom_found = true;
368 continue;
369 }
370 }
371
372 if (ctx->id_name &&
373 (ctx->id_index == UINT32_MAX) &&
374 (strcmp(tkey, ctx->id_name) == 0) &&
375 (typoid == INT2OID || typoid == INT4OID || typoid == INT8OID))
376 {
377 ctx->id_index = i;
378 }
379 else
380 {
381 ctx->column_cache.column_keys_index[i] = add_key(ctx, pstrdup(tkey));
382 }
383 }
384
385 if (!geom_found)
386 elog(ERROR, "parse_column_keys: no geometry column found");
387
388 if (ctx->id_name != NULL && ctx->id_index == UINT32_MAX)
389 elog(ERROR, "mvt_agg_transfn: Could not find column '%s' of integer type", ctx->id_name);
390}
#define UINT32_MAX
static uint32_t add_key(mvt_agg_context *ctx, char *name)
Definition mvt.c:314
static TupleDesc get_tuple_desc(mvt_agg_context *ctx)
Definition mvt.c:297
uint32_t geom_index
Definition mvt.h:64
char * id_name
Definition mvt.h:61
char * geom_name
Definition mvt.h:63
uint32_t id_index
Definition mvt.h:62
mvt_column_cache column_cache
Definition mvt.h:80
bool * nulls
Definition mvt.h:53
TupleDesc tupdesc
Definition mvt.h:54
uint32_t * column_keys_index
Definition mvt.h:50
Datum * values
Definition mvt.h:52
uint32_t * column_oid
Definition mvt.h:51

References add_key(), mvt_agg_context::column_cache, mvt_column_cache::column_keys_index, mvt_column_cache::column_oid, mvt_agg_context::geom_index, mvt_agg_context::geom_name, get_tuple_desc(), mvt_agg_context::id_index, mvt_agg_context::id_name, mvt_column_cache::nulls, mvt_column_cache::tupdesc, UINT32_MAX, and mvt_column_cache::values.

Referenced by mvt_agg_transfn().

Here is the call graph for this function:
Here is the caller graph for this function: