CartoDB / CartoDB-SQL-API

CartoDB SQL API
BSD 3-Clause "New" or "Revised" License
63 stars 64 forks source link

CDB_CartodbfyTable thinks its arguments are columns. #639

Closed pluc closed 4 years ago

pluc commented 4 years ago

When trying to create a table with the SQL API, via cURL for example:

curl "https://<domain>.carto.com/api/v2/sql?q=CREATE+TABLE+clientname_reports+(public+boolean,+verified+boolean,+published+boolean,+post_id+integer,+title+varchar,+sector+varchar,+author+varchar,+description+varchar,+reported_date+date);&api_key=<apiKey>

{"rows":[],"time":0.019,"fields":{},"total_rows":0,"infos":["_CDB_LinkGhostTables() called with username=<user>, event_name=CREATE TABLE"]}

curl "https://<domain>.carto.com/api/v2/sql?q=SELECT+CDB_CartodbfyTable(clientname_reports);&api_key=<apiKey>

{"error":["column \"clientname_reports\" does not exist"]}

Why does CDB_CartodbfyTable thinks its argument is a column? If anything, that error should be table does not exist, but the table does exist, so what is happening?

pluc commented 4 years ago

Even more... special, if I quote the table name, I get a different error, equally wrong:

curl "https://<domain>carto.com/api/v2/sql?q=SELECT+CDB_CartodbfyTable('clientname_reports');&api_key=<apiKey>

{"error":["relation \"clientname_reports\" does not exist"]}