-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Bug Description
We noticed that the USING keyword stopped working in our posthog project approximatelly this week. We used that keyword in a few views, and some dashboards broke due to those views returning errors.
I don't see the USING keyword being documented in https://posthog.com/docs/data-warehouse/sql, but it really worked before this week
MRE:
Not working:
with one_table AS (
SELECT 1 AS id, 2 as value
),
another_table AS (
SELECT 1 AS id, 3 as other_value
)
SELECT one_table.id, value, other_value FROM one_table JOIN another_table USING(id)Error:
JOIN INNER JOIN ... USING (one_table.id) using identifier 'one_table.id' cannot be resolved from right table expression. In scope SELECT one_table.id AS id, one_table.value AS value, another_table.other_value AS other_value FROM (SELECT 1 AS id, 2 AS value) AS one_table INNER JOIN (SELECT 1 AS id, 3 AS other_value) AS another_table USING (one_table.id) LIMIT 0, 101 SETTINGS readonly = 2, max_execution_time = 600, allow_experimental_object_type = 1, format_csv_allow_double_quotes = 0, max_ast_elements = 4000000, max_expanded_ast_elements = 4000000, max_bytes_before_external_group_by = 0, allow_experimental_analyzer = 1, transform_null_in = 1, optimize_min_equality_disjunction_chain_length = 4294967295, allow_experimental_join_condition = 1, use_hive_partitioning = 0.
Working alternative (equivalent):
with one_table AS (
SELECT 1 AS id, 2 as value
),
another_table AS (
SELECT 1 AS id, 3 as other_value
)
SELECT one_table.id, value, other_value FROM one_table JOIN another_table on one_table.id = another_table.idWas something related to this deployed this week on PostHog Cloud?
Debug info
- [x] PostHog Cloud, Debug information: Our project ID is `240542`