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