> You have overstated the requirements upon SQL identifiers.  Quoting via
> surrounding double-quote is only necessary if the identifier would not meet
> the definition of a "regular identifier", loosely understood to be a letter
> followed by letter, digit or underscore characters.

Also quoting is required if your identifier is the same as one of
SQLite's keywords (like "select", "table", "from" etc).


Pavel


On Mon, Jun 11, 2012 at 4:04 PM, Larry Brasfield
<larry_brasfi...@iinet.com> wrote:
> On June 11, rick wrote:
>>
>> Yes, it can be explained: <http://www.sqlite.org/lang_keywords.html> says:
>>
>> 'keyword'  A keyword in single quotes is a string literal.
>> "keyword"  A keyword in double-quotes is an identifier
>>
>> So, "id" is interpreted as a column name, not as the string literal 'id',
>> unless the value in the double quotes is not an identifier (column name).
>
>
> You have overstated the requirements upon SQL identifiers.  Quoting via
> surrounding double-quote is only necessary if the identifier would not meet
> the definition of a "regular identifier", loosely understood to be a letter
> followed by letter, digit or underscore characters.  Hence, the text "id"
> without any quotes would be a valid SQL identifier.
>
> From http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt :
>
>  <actual identifier> ::=
>                <regular identifier>
>              | <delimited identifier>
>
>  <regular identifier> ::= <identifier body>
>
>         <identifier body> ::=
>              <identifier start> [ { <underscore> | <identifier part> }... ]
>
>
>         <identifier start> ::= !! See the Syntax Rules
>
>         <identifier part> ::=
>                <identifier start>
>              | <digit>
>
> 1) An <identifier start> is one of:
>
>            a) A <simple Latin letter>; or
>
>            b) A character that is identified as a letter in the character
>              repertoire identified by the <module character set specifica-
>              tion> or by the <character set specification>; or
>
>            c) A character that is identified as a syllable in the char-
>              acter repertoire identified by the <module character set
>              specification> or by the <character set specification>; or
>
>            d) A character that is identified as an ideograph in the char-
>              acter repertoire identified by the <module character set
>              specification> or by the <character set specification>.
>
> --
> Larry Brasfield
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to