Re: [SQL] parser :parse error

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] parser :parse error
Дата
Msg-id 29186.942479419@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] parser :parse error  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-sql
[ sorry for not responding sooner, but I was on vacation... ]

>> create table tablename (
>> thefield varchar(50) default 'Fred''s car'
>> );
>> 
>> Error : parser: parse error at or near "s"

Bruce Momjian <maillist@candle.pha.pa.us> writes:
> Works on current tree.  Try 6.5.3.

It does work now, but is broken in 6.5.* and (AFAIK) all prior releases.
The problem is that the parser retranslates DEFAULT expressions into
source form after parsing them --- and the retranslation code is not
bright enough to provide quoting for embedded quotes and backslashes
in string constants.  So the system ends up trying to processDEFAULT 'Fred's car'
which obviously won't work.

Current sources fix this by eliminating the retranslation step.  That's
a pretty major change, so I don't think it's practical/safe to backpatch
it into 6.5.*.  If someone wants to fix this problem as a patch for
6.5.*, probably the best way to proceed would be to fix
backend/parser/gram.y's makeConstantList() to apply appropriate
backslash-quoting within string constants.  I don't have the time or
interest to do it myself though.
        regards, tom lane


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

Предыдущее
От: wieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [SQL] HAVING in EXISTS-clause ...
Следующее
От: Mark Stosberg
Дата:
Сообщение: Porting MySQL's DESCRIBE and ENUM features