Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id CAA16986 for ; Sat, 13 Nov 1999 02:51:17 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id CAA29188; Sat, 13 Nov 1999 02:50:19 -0500 (EST) To: Bruce Momjian cc: Frederic boucher , pgsql-sql@postgreSQL.org Subject: Re: [SQL] parser :parse error In-reply-to: Your message of Mon, 8 Nov 1999 15:39:33 -0500 (EST) <199911082039.PAA19322@candle.pha.pa.us> Date: Sat, 13 Nov 1999 02:50:19 -0500 Message-ID: <29186.942479419@sss.pgh.pa.us> From: Tom Lane [ 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 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