Errors
400 - unknown column
What happened
The table exists, but the request names a column that its schema does not define.
- Check the query nameInspect the column spelling and table alias.
- Read the table schemaConfirm which columns actually exist.
- Run the corrected queryUse the intended column and inspect the returned fields.
Request that triggers it
Selecting a column that isn't in the schema.
curl -X POST "https://$OC_HOST/v1/tenants/$OC_TENANT/sql" \
-H "Authorization: Bearer $OC_TOKEN" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT bogus_col FROM shop.customers LIMIT 1"}'Read the response
{
"error": "unknown_column",
"message": "column 'bogus_col' is not declared on table 'shop.customers'",
"retry": false
}Fix the request
- Check the column spelling and case.
- Read the table schema.
- Qualify columns with the right alias in joins.
- Correct the query or explicitly update the intended schema.
Keep in mind: Do not create a new column just to hide a typo in an existing query.
Common causes
- Typo in the column name.
- SQL written against a newer schema version than the one currently registered.
- Aliasing in a JOIN where the alias scope was lost.
SELECT *works, then a specific column was added - check spelling against the manifest.- Confusing a JSON sub-field with a top-level column (sub-fields require
json_extract(...)).
Continue
See error handling and retries, or return to error examples.