pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe
4+ messages / 4 participants
[nested] [flat]
* BUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe
@ 2011-11-03 16:35 Gary Kenney <gary.kenney@xerox.com>
0 siblings, 2 replies; 4+ messages in thread
From: Gary Kenney @ 2011-11-03 16:35 UTC (permalink / raw)
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
:
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe
@ 2011-11-03 19:19 Tom Lane <tgl@sss.pgh.pa.us>
parent: Gary Kenney <gary.kenney@xerox.com>
1 sibling, 0 replies; 4+ messages in thread
From: Tom Lane @ 2011-11-03 19:19 UTC (permalink / raw)
To: Gary Kenney <gary.kenney@xerox.com>; +Cc: pgsql-bugs@postgresql.org
"Gary Kenney" <gary.kenney@xerox.com> writes:
> Description: PreparedStatement#executeUpdate gets syntax error on
> apostrophe
> The value that was assigned via PreparedStatement.setString, was "Gary's
> Document". Note the apostrophe. Without the apostrophe, there is no error.
Right offhand I would guess that you are using an old JDBC driver that
isn't prepared for standard_conforming_strings to be turned on.
If that isn't it, I'd suggest asking for help on the pgsql-jdbc mailing
list; I'm not sure how many of those guys read pgsql-bugs.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Fwd: [BUGS] BUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe
@ 2011-11-03 23:37 Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>
parent: Gary Kenney <gary.kenney@xerox.com>
1 sibling, 1 reply; 4+ messages in thread
From: Johann 'Myrkraverk' Oskarsson @ 2011-11-03 23:37 UTC (permalink / raw)
To: pgsql-jdbc; +Cc: gary.kenney@xerox.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 );
}
}
}
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Fwd: [BUGS] BUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe
@ 2011-11-04 10:31 Dave Cramer <pg@fastcrypt.com>
parent: Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>
0 siblings, 0 replies; 4+ messages in thread
From: Dave Cramer @ 2011-11-04 10:31 UTC (permalink / raw)
To: Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>; +Cc: pgsql-jdbc; gary.kenney@xerox.com
Due to the fact that this is using a very old driver. jdbc1 has not
been part of the driver for a number of years now.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On Thu, Nov 3, 2011 at 7:37 PM, Johann 'Myrkraverk' Oskarsson
<johann@2ndquadrant.com> wrote:
>
> 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/
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2011-11-04 10:31 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03 16:35 BUG #6285: PreparedStatement#executeUpdate gets syntax error on apostrophe Gary Kenney <gary.kenney@xerox.com>
2011-11-03 19:19 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-11-03 23:37 ` Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>
2011-11-04 10:31 ` Dave Cramer <pg@fastcrypt.com>
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