CartoDB-SQL-API
CartoDB-SQL-API copied to clipboard
export to csv with default column names fails
http://javi.cartodb.com/api/v1/sql?q=select%20st_astext(st_makepoint(0,0))&format=csv
@javisantana by "fails" I understand that you're getting an empty document, right? I'm not getting any errors, just a blank CSV.
I think this is the same problem than #204
It's not the same problem, check:
https://documentation.cartodb.com/api/v1/sql?q=select%20st_astext(st_makepoint(0,0))&format=csv
vs
https://documentation.cartodb.com/api/v1/sql?q=select%20st_astext(st_makepoint(0,0))%20p&format=csv
ok!
vamos!
https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrsf_frmts/pg/ogrpglayer.cpp#L1387-L1403
Here's where it actually gets called
https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrsf_frmts/pg/ogrpglayer.cpp#L2075
OGR is trying to catch queries that generate geometry (in both binary and text representations) and avoid putting those representations into non-geometry columns. It does so in your test because you use a common output function signature (st_astext) and then output to a format that OGR doesn't write geometry into by default (so the column "disappears")
Options:
- rewrite the query slightly before handing it to OGR to avoid using the "magic function names" as column names
- add a config parameter to OGR to make the "magic name passing" behavior optional