You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2020/09/18 05:40:00 UTC

[jira] [Resolved] (CALCITE-4246) When parsing SQL in BigQuery dialect, allow unquoted table names to contain hyphens

     [ https://issues.apache.org/jira/browse/CALCITE-4246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde resolved CALCITE-4246.
----------------------------------
    Fix Version/s: 1.26.0
       Resolution: Fixed

Fixed in [df571c9c|https://github.com/apache/calcite/commit/df571c9c629d35c3e91e70194854c609b25381d2].

> When parsing SQL in BigQuery dialect, allow unquoted table names to contain hyphens
> -----------------------------------------------------------------------------------
>
>                 Key: CALCITE-4246
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4246
>             Project: Calcite
>          Issue Type: Bug
>          Components: babel
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.26.0
>
>
> When parsing SQL in BigQuery dialect, allow unquoted table names to contain hyphens. This feature was [added in May 2020|https://www.reddit.com/r/bigquery/comments/fgk31y/new_in_bigquery_no_more_backticks_around_table/].
> For these purposes, "table names" are considered to be the first identifier after FROM, JOIN, INSERT, UPDATE, DELETE, TABLE without an intervening SELECT or SET. (Yeah, the rules are rather rigid, but to implement it we have to shift lexical states in the parser, and we can only do that based on what tokens we've seen. Hopefully the rules will suffice.)
> Valid identifiers with hyphens:
> * {{select * from bigquery-public-data.foo}}
> * {{insert into bigquery-public-data.foo values (1)}}
> * {{delete from bigquery-public-data.foo}}
> * {{select * from dept cross join bigquery-public-data.foo}}
> Invalid identifiers with hyphens:
> * {{select foo-bar from dept}} # column names cannot have hyphens
> * {{select * from dept as foo-bar}} # table aliases cannot have hyphens
> * {{select foo-bar.deptno from dept as `foo-bar`}} # ditto
> * {{select * from foo.bar-baz.bump}} # only first part of table name
> In all of the above 'invalid' cases, you can solve by enclosing the identifier with back-ticks, e.g. {{select `foo-bar` from dept}}.
> To control this feature, in {{interface SqlConformance}}, add method {{boolean allowHyphenInUnquotedTableName()}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)