I've found the change made in version psqlodbc 8.2.0501 and later
4. Be more careful about <for locking clause> 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:
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.
The quick fix was to remove the trailing semicolons in my code, but a
better fix would be to make the parser smart enough to put the " for read
only" clause in front of an existing semicolon, not after it.
Who: L Jack Wilson
How: Remove Capital Letters from above for a valid email address
Why: Standard Disclaimer fits nicely here.
pgsql-odbc by date
|Next:||From: Hiroshi Inoue||Date: 2008-03-06 02:24:53|
|Subject: Re: " for read only" clause appended for safety when UseDeclareFetch=1
breaks some sql statements with trailing semicolons|
|Previous:||From: Hiroshi Saito||Date: 2008-03-05 14:25:31|
|Subject: Re: Build and other trouble with 08.03.0100 on Linux|