You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Itiel Sadeh <it...@sqreamtech.com.INVALID> on 2022/08/16 07:11:58 UTC

Dollar sign in identifiers

Hello all,

I've notice the following definition of identifier in parser.jj:
< IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >

Where the <LETTER> definition includes the dollar sign ($).
The Calcite documentation, as well as other databases doesn't permit
identifiers to start with dollar sign:

> Unquoted identifiers, such as emp, must start with a letter and can only
> contain letters, digits, and underscores. They are implicitly converted to
> upper case.
>

Is there a reason for this?

Thanks,
Itiel

Re: Dollar sign in identifiers

Posted by Julian Hyde <jh...@gmail.com>.
Can you please log a jira case to clarify the documentation? (We could consider changing the behavior it is way off the norm.)

> On Aug 17, 2022, at 12:39 AM, Itiel Sadeh <it...@sqreamtech.com.INVALID> wrote:
> 
> Sorry, it was a bad wording.
> The question was specifically about identifiers that *starts* with a dollar
> sign, such as "$jk".
> 
> On Tue, Aug 16, 2022 at 9:53 PM Julian Hyde <jh...@gmail.com> wrote:
> 
>> Probably a documentation mistake. Many databases allow ‘$’ and ‘#’ in
>> identifiers. For example the following work on Oracle and MySQL:
>> 
>>  CREATE TABLE t (i INTEGER);
>>  SELECT i AS j$k FROM t;
>> 
>> And this works on Oracle:
>> 
>>  SELECT i AS j#k FROM t;
>> 
>> Julian
>> 
>> 
>> 
>>> On Aug 16, 2022, at 12:11 AM, Itiel Sadeh <it...@sqreamtech.com.INVALID>
>> wrote:
>>> 
>>> Hello all,
>>> 
>>> I've notice the following definition of identifier in parser.jj:
>>> < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
>>> 
>>> Where the <LETTER> definition includes the dollar sign ($).
>>> The Calcite documentation, as well as other databases doesn't permit
>>> identifiers to start with dollar sign:
>>> 
>>>> Unquoted identifiers, such as emp, must start with a letter and can only
>>>> contain letters, digits, and underscores. They are implicitly converted
>> to
>>>> upper case.
>>>> 
>>> 
>>> Is there a reason for this?
>>> 
>>> Thanks,
>>> Itiel
>> 
>> 


Re: Dollar sign in identifiers

Posted by Itiel Sadeh <it...@sqreamtech.com.INVALID>.
Sorry, it was a bad wording.
The question was specifically about identifiers that *starts* with a dollar
sign, such as "$jk".

On Tue, Aug 16, 2022 at 9:53 PM Julian Hyde <jh...@gmail.com> wrote:

> Probably a documentation mistake. Many databases allow ‘$’ and ‘#’ in
> identifiers. For example the following work on Oracle and MySQL:
>
>   CREATE TABLE t (i INTEGER);
>   SELECT i AS j$k FROM t;
>
> And this works on Oracle:
>
>   SELECT i AS j#k FROM t;
>
> Julian
>
>
>
> > On Aug 16, 2022, at 12:11 AM, Itiel Sadeh <it...@sqreamtech.com.INVALID>
> wrote:
> >
> > Hello all,
> >
> > I've notice the following definition of identifier in parser.jj:
> > < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
> >
> > Where the <LETTER> definition includes the dollar sign ($).
> > The Calcite documentation, as well as other databases doesn't permit
> > identifiers to start with dollar sign:
> >
> >> Unquoted identifiers, such as emp, must start with a letter and can only
> >> contain letters, digits, and underscores. They are implicitly converted
> to
> >> upper case.
> >>
> >
> > Is there a reason for this?
> >
> > Thanks,
> > Itiel
>
>

Re: Dollar sign in identifiers

Posted by Julian Hyde <jh...@gmail.com>.
Probably a documentation mistake. Many databases allow ‘$’ and ‘#’ in identifiers. For example the following work on Oracle and MySQL:

  CREATE TABLE t (i INTEGER);
  SELECT i AS j$k FROM t;

And this works on Oracle:

  SELECT i AS j#k FROM t;

Julian



> On Aug 16, 2022, at 12:11 AM, Itiel Sadeh <it...@sqreamtech.com.INVALID> wrote:
> 
> Hello all,
> 
> I've notice the following definition of identifier in parser.jj:
> < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
> 
> Where the <LETTER> definition includes the dollar sign ($).
> The Calcite documentation, as well as other databases doesn't permit
> identifiers to start with dollar sign:
> 
>> Unquoted identifiers, such as emp, must start with a letter and can only
>> contain letters, digits, and underscores. They are implicitly converted to
>> upper case.
>> 
> 
> Is there a reason for this?
> 
> Thanks,
> Itiel