You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parser/bigquery: PIVOT/UNPIVOT rejected although BigQuery capabilities advertise support #854
dialect.Capabilities for BigQuery sets SupportsPivotUnpivot: true (pkg/sql/dialect/capabilities.go), but the parser gates PIVOT/UNPIVOT on a hard-coded dialect list that omits BigQuery:
gosqlx validate --dialect bigquery "SELECT * FROM sales PIVOT (SUM(amount) FOR quarter IN ('Q1', 'Q2'))"# ❌ Invalid SQL: Error E2002 at line 1, column 27: expected statement, got LPAREN
The same query is valid under --dialect snowflake and --dialect sqlserver.
Suggested fix
Gate on p.Capabilities().SupportsPivotUnpivot (as isQualifyKeyword does with SupportsQualify) instead of the dialect list, then add BigQuery PIVOT/UNPIVOT parser tests and check that BigQuery's syntax differences (e.g. aliases on IN values, UNPIVOT ... INCLUDE NULLS) are handled. Check that no other dialect's capabilities claim PIVOT without parser support.
Found while fixing the v1.16.0 release review notes (#853); the README deliberately does not list PIVOT for BigQuery until this is fixed.
Activity
fix(parser): BigQuery PIVOT/UNPIVOT (#854) (#857)