Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Odbc > " for read only...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 2306 of 2383
Post > Topic >>

" for read only" clause appended for safety when UseDeclareFetch=1 breaks

by ljwilson@[EMAIL PROTECTED] (Jack Wilson) Mar 5, 2008 at 12:24 PM

This is a multipart message in MIME format.
--=_alternative 005F978985257403_=
Content-Type: text/plain; charset="US-ASCII"

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 <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:
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.

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.

Thanks...jack
-- 
********************************************
Who:    L Jack Wilson
Where:  ljwilson@[EMAIL PROTECTED]
    Remove Capital Letters from above for a valid email address
Why:    Standard Disclaimer fits nicely here.
--=_alternative 005F978985257403_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">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)<br>
</font>
<br><font size=2 face="sans-serif">4. Be more careful about &lt;for
locking
clause&gt; in UseDeclareFetch mode.<br>
 &nbsp; Add missing? &quot;for read only&quot; clause for read only
queries
for 8.3<br>
 &nbsp; or later servers for safety.</font>
<br>
<br><font size=2 face="sans-serif">Here is a cvs link to the actual code
change:</font>
<br><font size=2
face="sans-serif">http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/psqlodbc/psqlodbc/convert.c.diff?r1=1.163&amp;r2=1.164</font>
<br>
<br><font size=2 face="sans-serif">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
&quot;
for read only&quot; 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) &quot;select blah blah; for read
only&quot;,
which gives a syntax error like:</font>
<br>
<br><font size=2 face="sans-serif">ERROR: syntax error at or near
&quot;for&quot;</font>
<br><font size=2 face="sans-serif">SQL state: 42601</font>
<br>
<br><font size=2 face="sans-serif">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 &quot; for read only&quot; from being appended
to the end of the sql statement.</font>
<br>
<br><font size=2 face="sans-serif">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 &quot; for read only&quot; clause in front of an
existing
semicolon, not after it.</font>
<br>
<br><font size=2 face="sans-serif">Thanks...jack</font>
<br><font size=2 face="sans-serif">-- </font>
<br><font size=2
face="sans-serif">********************************************</font>
<br><font size=2 face="sans-serif">Who: &nbsp; &nbsp;L Jack Wilson</font>
<br><font size=2 face="sans-serif">Where:
&nbsp;ljwilson@[EMAIL PROTECTED]
>
<br><font size=2 face="sans-serif">How: &nbsp; &nbsp;Remove Capital
Letters
from above for a valid email address</font>
<br><font size=2 face="sans-serif">Why: &nbsp; &nbsp;Standard Disclaimer
fits nicely here.</font>
--=_alternative 005F978985257403_=--
 




 8 Posts in Topic:
" for read only" clause appended for safety when UseDeclareFetch
ljwilson@[EMAIL PROTECTED  2008-03-05 12:24:27 
Re: " for read only" clause appended for safety when UseDeclareF
inoue@[EMAIL PROTECTED]   2008-03-06 11:24:53 
Re: " for read only" clause appended for safety when UseDeclareF
ljwilson@[EMAIL PROTECTED  2008-03-06 08:14:00 
Re: " for read only" clause appended for safety when UseDeclareF
inoue@[EMAIL PROTECTED]   2008-03-08 03:09:12 
Re: " for read only" clause appended for safety when UseDeclareF
ljwilson@[EMAIL PROTECTED  2008-03-07 14:49:27 
Re: Re: " for read only" clause appended for safety when UseDecl
alepaes@[EMAIL PROTECTED]  2008-06-10 11:45:59 
Re: Re: " for read only" clause appended for safety when UseDecl
alepaes@[EMAIL PROTECTED]  2008-06-10 14:32:01 
Re: Re: " for read only" clause appended for safety when UseDecl
inoue@[EMAIL PROTECTED]   2008-06-11 09:57:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 4:41:50 CDT 2008.