Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 31397B5DC52 for ; Thu, 3 Nov 2011 20:38:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 11240-10 for ; Thu, 3 Nov 2011 23:38:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from outmail149101.authsmtp.com (outmail149101.authsmtp.com [62.13.149.101]) by mail.postgresql.org (Postfix) with ESMTP id DB7B5B5D91F for ; Thu, 3 Nov 2011 20:38:05 -0300 (ADT) Received: from mail-c194.authsmtp.com (mail-c194.authsmtp.com [62.13.128.121]) by punt5.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id pA3Nc50f076466; Thu, 3 Nov 2011 23:38:05 GMT Received: from asuka.2ndquadrant.com (85-220-48-170.dsl.dynamic.simnet.is [85.220.48.170]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2) with ESMTP id pA3Nbx44033075; Thu, 3 Nov 2011 23:38:00 GMT To: PostgreSQL JDBC Cc: gary.kenney@xerox.com Subject: Re: Fwd: [BUGS] BUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe References: <201111031635.pA3GZaOK009935@wwwmaster.postgresql.org> From: "Johann 'Myrkraverk' Oskarsson" Date: Thu, 03 Nov 2011 23:37:37 +0000 In-Reply-To: (Simon Riggs's message of "Thu, 3 Nov 2011 16:59:14 +0000") Message-ID: User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Server-Quench: de6fc7b3-0674-11e1-80b9-0022640b883e X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZXSwQT DCUsVilMUBgsKgdF BwNFJgxfNl8UURhQ KkJXbgASJgVHAnde RXkJW1VVQF9yU2B9 YQpQIw1YfEhMXxtu WFZIRVJNFgBqBAMB SF5vUWcgPwFCeH1z ZUFnEHdcWkw0IRN7 FB1TR24bZWFnbH0e URVZagtUIgpXfh9H aFZ7VCEFaWZSKBg1 TUcdIDxjdQZ1FQtu d0knEH1aChhRTmNu DygYEC0mB0AJfDk6 MxEjJ1gAV0sBP04v LVYcQV4RLxJaBQBC BAlWESlFLklJSjAx ChkSWkhWGSVaWjtG BQUoL3fd X-Authentic-SMTP: 61633235383639.1015:706 X-AuthFastPath: 0 (Was 255) X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201111/6 X-Sequence-Number: 22341 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable I am unable to reproduce this, with the attached code. I am using PostgreSQL 9.1.0 with the 9.1-901.jdbc4 driver on OpenIndiana. > ---------- Forwarded message ---------- > From: Gary Kenney > Date: Thu, Nov 3, 2011 at 4:35 PM > Subject: [BUGS] BUG #6285: PreparedStatement#executeUpdate gets syntax > error on apostrophe > To: pgsql-bugs@postgresql.org > > > > The following bug has been logged online: > > Bug reference: =A0 =A0 =A06285 > Logged by: =A0 =A0 =A0 =A0 =A0Gary Kenney > Email address: =A0 =A0 =A0gary.kenney@xerox.com > PostgreSQL version: 9.1.1 > Operating system: =A0 Windows 7 > Description: =A0 =A0 =A0 =A0PreparedStatement#executeUpdate gets syntax e= rror on > apostrophe > Details: > > The value that was assigned via PreparedStatement.setString, was "Gary's > Document". =A0Note the apostrophe. =A0Without the apostrophe, there is no= error. > =A0Stack trace: > > 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - =A0 =A0at > org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139) > 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - =A0 =A0at > org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:152) > 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - =A0 =A0at > org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100) > 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - =A0 =A0at > org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) > 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - =A0 =A0at > org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statemen= t.j > ava:517) > 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - =A0 =A0at > org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statemen= t.j > ava:50) > 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - =A0 =A0at > org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1St= ate > ment.java:273) > : > my code > : > > -- > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-bugs --=20 Johann Oskarsson http://www.2ndquadrant.com/ |[] PostgreSQL Development, 24x7 Support, Training and Services --+-- | Blog: http://my.opera.com/myrkraverk/blog/ --=-=-= Content-Disposition: attachment; filename=SetStringBug.java import java.sql.PreparedStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.ResultSet; public class SetStringBug { public static void main( String[] argv ) { try { Connection c = DriverManager.getConnection ("jdbc:postgresql:johann"); PreparedStatement s = c.prepareStatement ("select ?::text"); s.setString( 1, "Gary's Document" ); ResultSet r = s.executeQuery(); r.next(); System.out.println( r.getString( 1 ) ); } catch ( SQLException e ) { e.printStackTrace(); System.exit( 2 ); } } } --=-=-=--