PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ encode_keys()

static void encode_keys ( struct geobuf_agg_context ctx)
static

Definition at line 52 of file geobuf.c.

53 {
54  TupleDesc tupdesc = get_tuple_desc(ctx);
55  uint32_t natts = (uint32_t) tupdesc->natts;
56  char **keys = palloc(natts * sizeof(*keys));
57  uint32_t i, k = 0;
58  bool geom_found = false;
59  for (i = 0; i < natts; i++) {
60  Oid typoid = getBaseType(TupleDescAttr(tupdesc, i)->atttypid);
61  char *tkey = TupleDescAttr(tupdesc, i)->attname.data;
62  char *key = pstrdup(tkey);
63  if (ctx->geom_name == NULL) {
64  if (!geom_found && typoid == postgis_oid(GEOMETRYOID)) {
65  ctx->geom_index = i;
66  geom_found = 1;
67  continue;
68  }
69  } else {
70  if (!geom_found && strcmp(key, ctx->geom_name) == 0) {
71  ctx->geom_index = i;
72  geom_found = 1;
73  continue;
74  }
75  }
76  keys[k++] = key;
77  }
78  if (!geom_found)
79  elog(ERROR, "encode_keys: no geometry column found");
80  ctx->data->n_keys = k;
81  ctx->data->keys = keys;
82  ReleaseTupleDesc(tupdesc);
83 }
static TupleDesc get_tuple_desc(struct geobuf_agg_context *ctx)
Definition: geobuf.c:44
uint32_t geom_index
Definition: geobuf.h:51
char * geom_name
Definition: geobuf.h:50

References geobuf_agg_context::data, geobuf_agg_context::geom_index, geobuf_agg_context::geom_name, and get_tuple_desc().

Referenced by geobuf_agg_transfn().

Here is the call graph for this function:
Here is the caller graph for this function: