PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ parse_column_keys()

static void parse_column_keys ( mvt_agg_context ctx)
static

Definition at line 288 of file mvt.c.

289 {
290  uint32_t i, natts;
291  bool geom_found = false;
292 
293  POSTGIS_DEBUG(2, "parse_column_keys called");
294 
295  ctx->column_cache.tupdesc = get_tuple_desc(ctx);
296  natts = ctx->column_cache.tupdesc->natts;
297 
298  ctx->column_cache.column_keys_index = palloc(sizeof(uint32_t) * natts);
299  ctx->column_cache.column_oid = palloc(sizeof(uint32_t) * natts);
300  ctx->column_cache.values = palloc(sizeof(Datum) * natts);
301  ctx->column_cache.nulls = palloc(sizeof(bool) * natts);
302 
303  for (i = 0; i < natts; i++)
304  {
305  Oid typoid = getBaseType(TupleDescAttr(ctx->column_cache.tupdesc, i)->atttypid);
306  char *tkey = TupleDescAttr(ctx->column_cache.tupdesc, i)->attname.data;
307 
308  ctx->column_cache.column_oid[i] = typoid;
309 
310  if (typoid == JSONBOID)
311  {
313  continue;
314  }
315 
316  if (ctx->geom_name == NULL)
317  {
318  if (!geom_found && typoid == postgis_oid(GEOMETRYOID))
319  {
320  ctx->geom_index = i;
321  geom_found = true;
322  continue;
323  }
324  }
325  else
326  {
327  if (!geom_found && strcmp(tkey, ctx->geom_name) == 0)
328  {
329  ctx->geom_index = i;
330  geom_found = true;
331  continue;
332  }
333  }
334 
335  if (ctx->id_name &&
336  (ctx->id_index == UINT32_MAX) &&
337  (strcmp(tkey, ctx->id_name) == 0) &&
338  (typoid == INT2OID || typoid == INT4OID || typoid == INT8OID))
339  {
340  ctx->id_index = i;
341  }
342  else
343  {
344  ctx->column_cache.column_keys_index[i] = add_key(ctx, pstrdup(tkey));
345  }
346  }
347 
348  if (!geom_found)
349  elog(ERROR, "parse_column_keys: no geometry column found");
350 
351  if (ctx->id_name != NULL && ctx->id_index == UINT32_MAX)
352  elog(ERROR, "mvt_agg_transfn: Could not find column '%s' of integer type", ctx->id_name);
353 }
#define UINT32_MAX
Definition: lwin_wkt_lex.c:343
static uint32_t add_key(mvt_agg_context *ctx, char *name)
Definition: mvt.c:277
static TupleDesc get_tuple_desc(mvt_agg_context *ctx)
Definition: mvt.c:260
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:97
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: