Skip to content

Bigquery should support WEEK and QUARTER date_part #119

@Zedseayou

Description

@Zedseayou

I am using prettier-plugin-sql-cst and I am guessing this parse error should actually be raised here (instead of issue I closed here).

Formatting code which contains WEEK or QUARTER as the date_part fails with error.

e.g. trying to format this:

SELECT date_sub(DATE('2025-01-01'), INTERVAL 1 QUARTER)

gives me this:

["ERROR" - 3:59:48 PM] Error formatting document.
["ERROR" - 3:59:48 PM] Syntax Error: Unexpected "QUARTER"
Was expecting to see: "!=", "%", "&", "(", ")", "*", "+", ",", "-", "->", "->>", "/", ":", "<", "<<", "<=", "<>", "=", "==", ">", ">=", ">>", "AND", "BETWEEN", "DAY", "DIV", "GLOB", "HOUR", "IN", "IS", "ISNULL", "LIKE", "MATCH", "MINUTE", "MOD", "MONTH", "NOT", "NOTNULL", "OR", "REGEXP", "RLIKE", "SECOND", "YEAR", "[", "\", "]", "||", or whitespace
--> c:\Users\path\to\the\file\sql\test.sql:1:48
|
1 | SELECT date_sub(DATE('2025-01-01'), INTERVAL 1 QUARTER)
|                                               ^

It seems that WEEK and QUARTER should be supported per the Bigquery docs (also the code runs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions