pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>
To: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
Cc: gary.kenney@xerox.com
Subject: Re: Fwd: [BUGS] BUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe
Date: Thu, 03 Nov 2011 23:37:37 +0000
Message-ID: <x639e422wu.fsf@2ndquadrant.com> (raw )
In-Reply-To: <CA+U5nMJyTdFvX=0aJvaisoC7kCCjP+QuXMXA-NgscaiiCFw5Tg@mail.gmail.com >
References: <201111031635.pA3GZaOK009935@wwwmaster.postgresql.org >
<CA+U5nMJyTdFvX=0aJvaisoC7kCCjP+QuXMXA-NgscaiiCFw5Tg@mail.gmail.com >
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 <gary.kenney@xerox.com>
> 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: 6285
> Logged by: Gary Kenney
> Email address: gary.kenney@xerox.com
> PostgreSQL version: 9.1.1
> Operating system: Windows 7
> Description: PreparedStatement#executeUpdate gets syntax error on
> apostrophe
> Details:
>
> The value that was assigned via PreparedStatement.setString, was "Gary's
> Document". Note the apostrophe. Without the apostrophe, there is no error.
> Stack trace:
>
> 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - at
> org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139)
> 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - at
> org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:152)
> 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - at
> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100)
> 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - at
> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43)
> 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - at
> org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.j
> ava:517)
> 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
> ava:50)
> 01 Nov 2011 16:29:09 - [Thread[Thread-63,5,main]] - at
> org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1State
> 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
--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/
Attachments:
SetStringBug.java (text/plain, 612B) download
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 );
}
}
}
view thread (4+ messages) latest in thread
Message-ID: <x639e422wu.fsf@2ndquadrant.com>
Permalink: ../x639e422wu.fsf@2ndquadrant.com/
Also on: postgresql.org/message-id/x639e422wu.fsf@2ndquadrant.com
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: johann@2ndquadrant.com, gary.kenney@xerox.com
Subject: Re: Fwd: [BUGS] BUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe
In-Reply-To: <x639e422wu.fsf@2ndquadrant.com>
References: <201111031635.pA3GZaOK009935@wwwmaster.postgresql.org> <CA+U5nMJyTdFvX=0aJvaisoC7kCCjP+QuXMXA-NgscaiiCFw5Tg@mail.gmail.com> <x639e422wu.fsf@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox