PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ parse_column_keys()

static void parse_column_keys ( mvt_agg_context ctx)
static

Definition at line 336 of file mvt.c.

337 {
338  uint32_t i, natts;
339  bool geom_found = false;
340 
341  POSTGIS_DEBUG(2, "parse_column_keys called");
342 
343  ctx->column_cache.tupdesc = get_tuple_desc(ctx);
344  natts = ctx->column_cache.tupdesc->natts;
345 
346  ctx->column_cache.column_keys_index = palloc(sizeof(uint32_t) * natts);
347  ctx->column_cache.column_oid = palloc(sizeof(uint32_t) * natts);
348  ctx->column_cache.values = palloc(sizeof(Datum) * natts);
349  ctx->column_cache.nulls = palloc(sizeof(bool) * natts);
350 
351  for (i = 0; i < natts; i++)
352  {
353  Oid typoid = getBaseType(TupleDescAttr(ctx->column_cache.tupdesc, i)->atttypid);
354  char *tkey = TupleDescAttr(ctx->column_cache.tupdesc, i)->attname.data;
355 
356  ctx->column_cache.column_oid[i] = typoid;
357 
358  if (typoid == JSONBOID)
359  {
361  continue;
362  }
363 
364  if (ctx->geom_name == NULL)
365  {
366  if (!geom_found && typoid == postgis_oid(GEOMETRYOID))
367  {
368  ctx->geom_index = i;
369  geom_found = true;
370  continue;
371  }
372  }
373  else
374  {
375  if (!geom_found && strcmp(tkey, ctx->geom_name) == 0)
376  {
377  ctx->geom_index = i;
378  geom_found = true;
379  continue;
380  }
381  }
382 
383  if (ctx->id_name &&
384  (ctx->id_index == UINT32_MAX) &&
385  (strcmp(tkey, ctx->id_name) == 0) &&
386  (typoid == INT2OID || typoid == INT4OID || typoid == INT8OID))
387  {
388  ctx->id_index = i;
389  }
390  else
391  {
392  ctx->column_cache.column_keys_index[i] = add_key(ctx, pstrdup(tkey));
393  }
394  }
395 
396  if (!geom_found)
397  elog(ERROR, "parse_column_keys: no geometry column found");
398 
399  if (ctx->id_name != NULL && ctx->id_index == UINT32_MAX)
400  elog(ERROR, "mvt_agg_transfn: Could not find column '%s' of integer type", ctx->id_name);
401 }
#define UINT32_MAX
Definition: lwin_wkt_lex.c:343
static uint32_t add_key(mvt_agg_context *ctx, char *name)
Definition: mvt.c:325
static TupleDesc get_tuple_desc(mvt_agg_context *ctx)
Definition: mvt.c:308
uint32_t geom_index
Definition: mvt.h:72
char * id_name
Definition: mvt.h:67
char * geom_name
Definition: mvt.h:71
uint32_t id_index
Definition: mvt.h:68
mvt_column_cache column_cache
Definition: mvt.h:98
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: