SupersetErrorType.ADHOC_SUBQUERY_NOT_ALLOWED_ERROR thrown for valid quoted column name #30977
Open
3 tasks done
Labels
viz:charts:bar
Related to the Bar chart
Bug description
I set up a bar chart
X axis
value to a column named 'Created on'.When the chart data loads I get an error: "Custom SQL fields cannot contain sub-queries."
Sample chart SQL query:
SELECT DATE_TRUNC('day', "Created on") AS "Created on", sum("Estimated savings / Month") AS "SUM(Estimated savings / Month)" FROM public."Opportunities_4_userfriendly" WHERE ("Status" NOT IN ('Dismissed', 'Completed')) GROUP BY DATE_TRUNC('day', "Created on") LIMIT 50000;
In my case, choosing any other column containing the token 'on' for the
X axis
, such as "Update on" will lead to the same error.My guess is the bug originates from
superset/models/helpers.py#validate_adhoc_subquery
. The parser is likely incorrectly interpreting "Created on" as a table reference because of the word "on"Screenshots/recordings
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: