CartoDB-SQL-API
CartoDB-SQL-API copied to clipboard
csv error returning empty result with just headers
A query like select ST_X('MULTILINESTRING((-29 -27,-30 -29.7,-36 -31,-45 -33),(-45 -33,-46 -32))')
results in ERROR: Argument to X() must be a point
because st_x
does not support MULTILINESTRING
.
While using json/default format it reports correctly the error, for some large resultsets using csv fails to report the error and returns an empty csv file with just the headers for the column names.
Important this only happens if the result set is bigger than the number of rows used in the ogr2ogr cursor and the error is triggered not in the first batch.
STR
-
GET http://development.localhost.lan:8080/api/v1/sql?api_key=API_KEY&q=CREATE+TABLE+some_points_and_a_multistring+AS%0ASELECT+%27POINT%280+0%29%27%3A%3Ageometry+the_geom+from+generate_series%281%2C+1000%29%0AUNION+ALL%0ASELECT+%27MULTILINESTRING%28%28-29+-27%2C-30+-29.7%2C-36+-31%2C-45+-33%29%2C%28-45+-33%2C-46+-32%29%29%27%3A%3Ageometry+the_geom
-
GET http://development.localhost.lan:8080/api/v1/sql?api_key=4bf5a0b84515f6a67e0c2cbcc8552f73d0cc399d&q=SELECT%20ST_X(the_geom)%20lon%20FROM%20some_points_and_a_multistring&format=csv
Expected result
400 Bad request error as the ogr2ogr failed
Current result
csv file with just a lon
column header
Note: Newer versions of gdal/ogr2ogr might have fixed the issue.