Re: Inconsistent behaviour with Dollar-quoted String Constants

Andrew Dunstan <[email protected]> Sun, 08 Jan 2012 18:33:12 -0500
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>

On 01/08/2012 03:51 PM, David E. Wheeler wrote:
> Anyway, the ppg docs](http://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html) say about dollar quoting:
>
> “The tag, if any, of a dollar-quoted string follows the same rules as an unquoted identifier, except that it cannot contain a dollar sign.”
>
> And for an unquoted identifier, they say:
>
> “SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($).”
>
> Does 北 qualify as a non-Latin letter?

Any non-ASCII character qualifies. From scan.l:

    dolq_start      [A-Za-z\200-\377_]
    dolq_cont       [A-Za-z\200-\377_0-9]
    dolqdelim       \$({dolq_start}{dolq_cont}*)?\$


cheers

andrew