83 Datum array = PG_GETARG_DATUM(0);
84 text *geom_column_text = PG_GETARG_TEXT_P(1);
85 int32 maxdecimaldigits = PG_GETARG_INT32(2);
86 bool do_pretty = PG_GETARG_BOOL(3);
89 Oid geom_oid = InvalidOid;
90 Oid geog_oid = InvalidOid;
93 postgis_initialize_cache(fcinfo);
94 geom_oid = postgis_oid(GEOMETRYOID);
95 geog_oid = postgis_oid(GEOGRAPHYOID);
97 if (strlen(geom_column) == 0)
100 result = makeStringInfo();
102 composite_to_geojson(array, geom_column, maxdecimaldigits, result, do_pretty, geom_oid, geog_oid);
104 PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len));
static void composite_to_geojson(Datum composite, char *geom_column_name, int32 maxdecimaldigits, StringInfo result, bool use_line_feeds, Oid geom_oid, Oid geog_oid)
char * text_to_cstring(const text *textptr)