Delimited identifier length

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Delimited identifier length
Дата
Msg-id 17576.970583203@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: libpq PGHOST  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Delimited identifier length  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Tom Lane writes:
>> I don't see any clear statement in SQL92 that <delimited identifiers>
>> can't have zero length, so I'm not convinced there's anything wrong here.

> Hmm, I do:

>          <delimited identifier> ::=
>               <double quote> <delimited identifier body> <double quote>
>          <delimited identifier body> ::= <delimited identifier part>...
>          <delimited identifier part> ::=
>                 <nondoublequote character>
>               | <doublequote symbol>

> As opposed to, say, an empty character string literal:

>          <character string literal> ::=
>               [ <introducer><character set specification> ]
>               <quote> [ <character representation>... ] <quote>
>               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                 [ { <separator>... <quote> [ <character representation>... ] <quote> }... ] 

Hmm, you're right --- if they meant to allow zero-length identifiers
they'd have written something like
        <delimited identifier> ::=             <double quote> [ <delimited identifier body> ] <double quote>

I stand corrected.

Next question is do we want to change it?  I can't imagine any real good
use for a null-string name, but is there any risk of breaking existing
applications?

The actual fix would be trivial --- just introduce a complaint for
strlen(literalbuf)==0 into parser/scan.l's <xd>{xdstop} rule.
I'm just wondering if we should change or not.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Martin A. Marques"
Дата:
Сообщение: Re: backup and restore
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Autoconf version discrepancies