2

I found the list of reserved keywords for Standard SQL, at Standard SQL Lexical Structure - Lexical Structure - Reserved Keywords.

But I can't find the equivalent list for Legacy SQL, although there is a reference to it at Legacy SQL Functions and Operators - Query Syntax - SELECT Clause:

You can use square brackets to escape reserved words so that you can use them as field name and aliases. For example, if you have a column named "prefix", which is a reserved word in BigQuery syntax, the queries referencing that field will fail with obscure error messages unless you escape it with square brackets

I know some of the keywords are different; for example Legacy SQL has FLATTEN which I assume is reserved, which Standard SQL does not.

Any pointers would help.

lavinio
  • 23,931
  • 5
  • 55
  • 71

1 Answers1

0

There is not a specific Google's public documentation that specify the reserved words list for BigQuery legacy service. The most accurate reference I found is the Syntax differences that points out the escape reserved keywords methods you can use in Standard and Legacy versions, as you well mentioned before.

Based on this, I think that the current workaround is to use the available Reserved Keywords list as a reference and escape the words that are marked as reserved while using BigQuery. Additionally, you can use Send Feedback button located at the lower left and upper right corners of the Legacy SQL public documentation in order to request the addition of the keywords list for Legacy SQL.

Armin_SC
  • 2,130
  • 11
  • 15