Creating custom expressions with spaces in the name, then filtering, results in an error #22310
Labels
.Backend
Database/BigQuery
Drainable:Yes
Candidate for ramping up in a product area
Priority:P2
Average run of the mill bug
Querying/Nested Queries
Questions based on other saved questions
Querying/Notebook/Custom Expression
Querying/Processor
Type:Bug
Product defects
Milestone
Describe the bug
![image](https://user-images.githubusercontent.com/61659989/166158355-3a3e91f7-2a48-4296-a281-c8279f604026.png)
When creating a custom expression that has spaces in the name, e.g.
then applying a filter - the resulting question ends up with an error.
This error is caused by the subquery changing spaces in the column name to underscores (e.g.
Example_custom_expression
), then the final SELECT statement errors as it tries to select the column with the old name (Example custom expression
).This issue seems to occur when adding filters, as it results in the subquery being created with the underscores replacing spaces.
Logs
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A 400 bad request error due to the final SELECT statement using the custom expression name with spaces, and a subquery with the custom column aliases with underscores instead
Screenshots
![image](https://user-images.githubusercontent.com/61659989/166158787-e4210d00-05cf-48a2-a67c-dd991a4ea41a.png)
BigQuery editor showing the compiled SQL and the corresponding error.
This can be fixed manually by editing the SQL subquery to change the column name.
Information about your Metabase Installation:
Severity
Low for someone who is used to SQL and can manually edit queries, potentially medium otherwise
Additional context
N/A
The text was updated successfully, but these errors were encountered: