PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ parse_column_keys()

static void parse_column_keys ( mvt_agg_context ctx)
static

Definition at line 319 of file mvt.c.

320 {
321  uint32_t i, natts;
322  bool geom_found = false;
323 
324  POSTGIS_DEBUG(2, "parse_column_keys called");
325 
326  ctx->column_cache.tupdesc = get_tuple_desc(ctx);
327  natts = ctx->column_cache.tupdesc->natts;
328 
329  ctx->column_cache.column_keys_index = palloc(sizeof(uint32_t) * natts);
330  ctx->column_cache.column_oid = palloc(sizeof(uint32_t) * natts);
331  ctx->column_cache.values = palloc(sizeof(Datum) * natts);
332  ctx->column_cache.nulls = palloc(sizeof(bool) * natts);
333 
334  for (i = 0; i < natts; i++)
335  {
336 #if POSTGIS_PGSQL_VERSION < 110
337  Oid typoid = getBaseType(ctx->column_cache.tupdesc->attrs[i]->atttypid);
338  char *tkey = ctx->column_cache.tupdesc->attrs[i]->attname.data;
339 #else
340  Oid typoid = getBaseType(ctx->column_cache.tupdesc->attrs[i].atttypid);
341  char *tkey = ctx->column_cache.tupdesc->attrs[i].attname.data;
342 #endif
343 
344  ctx->column_cache.column_oid[i] = typoid;
345 #if POSTGIS_PGSQL_VERSION >= 94
346  if (typoid == JSONBOID)
347  {
349  continue;
350  }
351 #endif
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  ctx->column_cache.column_keys_index[i] = add_key(ctx, pstrdup(tkey));
373  }
374 
375  if (!geom_found)
376  elog(ERROR, "parse_column_keys: no geometry column found");
377 }
#define UINT32_MAX
Definition: lwin_wkt_lex.c:343
static uint32_t add_key(mvt_agg_context *ctx, char *name)
Definition: mvt.c:308
static TupleDesc get_tuple_desc(mvt_agg_context *ctx)
Definition: mvt.c:291
uint32_t geom_index
Definition: mvt.h:63
char * geom_name
Definition: mvt.h:62
mvt_column_cache column_cache
Definition: mvt.h:79
bool * nulls
Definition: mvt.h:54
TupleDesc tupdesc
Definition: mvt.h:55
uint32_t * column_keys_index
Definition: mvt.h:51
Datum * values
Definition: mvt.h:53
uint32_t * column_oid
Definition: mvt.h:52
unsigned int uint32_t
Definition: uthash.h:78

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_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: