Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B17312E0174 for ; Wed, 5 Mar 2008 22:25:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 39985-03 for ; Wed, 5 Mar 2008 22:24:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by postgresql.org (Postfix) with SMTP id 909312E0132 for ; Wed, 5 Mar 2008 22:25:03 -0400 (AST) Received: (qmail 14996 invoked from network); 6 Mar 2008 11:24:59 +0900 Received: from unknown (HELO ?127.0.0.1?) (100.0.32.195) by sd2.tpf-fw-c.co.jp with SMTP; 6 Mar 2008 11:24:59 +0900 Message-ID: <47CF55F5.8090309@tpf.co.jp> Date: Thu, 06 Mar 2008 11:24:53 +0900 From: Hiroshi Inoue User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Jack Wilson CC: pgsql-odbc@postgresql.org Subject: Re: " for read only" clause appended for safety when UseDeclareFetch=1 breaks some sql statements with trailing semicolons References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.373 tagged_above=0 required=5 tests=AWL=0.373 X-Spam-Level: X-Archive-Number: 200803/12 X-Sequence-Number: 9428 Hi Jack, Jack Wilson wrote: > > I've found the change made in version psqlodbc 8.2.0501 and later > (reference: > http://archives.postgresql.org/pgsql-committers/2007-10/msg00420.php) > > 4. Be more careful about in UseDeclareFetch mode. > Add missing? "for read only" clause for read only queries for 8.3 > or later servers for safety. > > Here is a cvs link to the actual code change: > http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/psqlodbc/psqlodbc/convert.c.diff?r1=1.163&r2=1.164 > > > This change breaks existing code that sends a single sql statement with > a trailing semicolon. What happens is the odbc driver sees > UseDeclareFetch=1 and for sql statements appends " for read only" at the > end of the statement. This is fine except for the situation where the > statement has a trailing semicolon. In that case the statement ends up > being (say) "select blah blah; for read only", which gives a syntax > error like: > > ERROR: syntax error at or near "for" > SQL state: 42601 > > Setting UseDeclareFetch=0 fixes the problem, or using psqlodbc 8.2.0500 > or earlier, or using PostgreSQL 8.2.6--any one of these prevents the " > for read only" from being appended to the end of the sql statement. Oops my fault. Unfortunately I'm very busy and please wait for a while. regards, Hiroshi Inoue