Re: [SQL] parser :parse error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Frederic boucher <dziablo(at)hotmail(dot)com>, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] parser :parse error
Date: 1999-11-13 07:50:19
Message-ID: 29186.942479419@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)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 process
DEFAULT '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

Browse pgsql-sql by date

  From Date Subject
Next Message Mark Stosberg 1999-11-13 16:33:15 Porting MySQL's DESCRIBE and ENUM features
Previous Message Jan Wieck 1999-11-13 03:17:30 Re: [SQL] HAVING in EXISTS-clause ...