X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1C39E329CB0 for ; Thu, 30 Sep 2004 12:15:07 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40419-09 for ; Thu, 30 Sep 2004 11:15:03 +0000 (GMT) Received: from brasil.brainstorm.fr (brasil.brainstorm.fr [193.56.58.33]) by svr1.postgresql.org (Postfix) with ESMTP id 7B2A932A400 for ; Thu, 30 Sep 2004 12:15:04 +0100 (BST) Received: by brasil.brainstorm.fr (Postfix, from userid 1005) id C6DEA26AE34; Thu, 30 Sep 2004 13:15:02 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Mailer: Manitou v0.9.4 From: "Daniel Verite" Subject: bugfix proposal for ecpglib prepare's parse code To: pgsql-interfaces@postgresql.org Date: Thu, 30 Sep 2004 13:12:35 +0200 Message-Id: <20040930131206.2513124@localhost> X-Face: 0N#]; "Miw2ss`WySq(ZLLy[=.ai4D}yI#'n*PU:{%/ZVSUd*G$EuN$v@TyBnpW5x=-m*Jc?Cm&=kXN#l; pePLb!,P.9D4M]fHU+XMPTe(>>'( X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/20 X-Sequence-Number: 5095 Hello, A problem with ecpg reported in pgsql-fr-general: http://archives.postgresql.org/pgsql-fr-generale/2004-09/msg00024.php boils down to ecpglib interpreting two consecutive colons as a placeholder (or maybe two) for a host variable in the context of an EXEC SQL PREPARE :stmt This leads to failure when '::' is used in the statement as a cast operator, as it is in the message pointed above. The small patch below is a fix for this (it applies within pg8.0.0-beta3 to src/interfaces/ecpg/ecpglib/prepare.c): *** prepare.c~ Fri May 21 15:50:12 2004 --- prepare.c Wed Sep 29 17:35:58 2004 *************** *** 46,54 **** if (!string && *ptr == ':') { ! *ptr = '?'; ! for (++ptr; *ptr && isvarchar(*ptr); ptr++) ! *ptr = ' '; } } } --- 46,59 ---- if (!string && *ptr == ':') { ! if (ptr[1]==':') ! ptr+=2; /* skip '::' */ ! else ! { ! *ptr = '?'; ! for (++ptr; *ptr && isvarchar(*ptr); ptr++) ! *ptr = ' '; ! } } } } Regards, -- Daniel PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org