PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ parse_column_keys()

static void parse_column_keys ( mvt_agg_context ctx)
static

Definition at line 337 of file mvt.c.

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