PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ parse_column_keys()

static void parse_column_keys ( mvt_agg_context ctx)
static

Definition at line 286 of file mvt.c.

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