71 flatgeobuf_column **columns;
72 uint32_t columns_size = 0;
73 Oid tupType = HeapTupleHeaderGetTypeId(ctx->
row);
74 int32 tupTypmod = HeapTupleHeaderGetTypMod(ctx->
row);
75 TupleDesc tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod);
76 int natts = tupdesc->natts;
77 bool geom_found =
false;
79 POSTGIS_DEBUG(2,
"calling inspect_table");
81 columns = palloc(
sizeof(flatgeobuf_column *) * natts);
86 for (
int i = 0; i < natts; i++) {
87 Oid typoid = getBaseType(TupleDescAttr(tupdesc, i)->atttypid);
88 const char *key = TupleDescAttr(tupdesc, i)->attname.data;
89 POSTGIS_DEBUGF(2,
"inspecting column definition for %s with oid %d", key, typoid);
91 if (!geom_found && typoid == postgis_oid(GEOMETRYOID)) {
97 if (!geom_found && strcmp(key, ctx->
geom_name) == 0) {
103 POSTGIS_DEBUGF(2,
"creating column definition for %s with oid %d", key, typoid);
105 c = (flatgeobuf_column *) palloc0(
sizeof(flatgeobuf_column));
106 c->name = pstrdup(key);
108 columns[columns_size] = c;
113 elog(ERROR,
"no geom column found");
115 if (columns_size > 0) {
116 ctx->
ctx->columns = columns;
117 ctx->
ctx->columns_size = columns_size;
static uint8_t get_column_type(Oid typoid)