possible bug
possible bug
От:
Alberto Rodriguez Galdo <argaldo@gmail.com>
Дата:
Hi,
I've found that this query fails:
insert into backupItem
(idbackup,pathservidor,pathoriginal,hash,esenlace,metadatos) values
(null,'/home/argaldo/datos/software/tomcat/tomcat/webapps/ubt/backup/dani/null/home/argaldo/test/prueba','/home/argaldo/test/prueba','1C940736976FFFFFFFCFFFFFF866EFFFFFFECFFFFFF827EFFFFFFDC413F7FFFFFFAF76FFFFFFF967','false','
420
1000
UNIX
false
false
1114629588
1000
1114644020
')
this query is generated concatenating several strings in Java.
This is the stackTrace:
org.postgresql.util.PSQLException: ERROR: invalid message format
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:314)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:306)
at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.execute(DelegatingStatement.java:261)
at es.ultreia.ubt.server.ServletRecepcionArchivoBackup.doPost(Unknown
Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:526)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
The same query works using psql in console and phppgadmin and began to
fail as the xml field "metadatos" was added.
I've been playing a while with the query and found also that if I
omit the double quotes (") of the xml field, the query works well with
jdbc, but this is not acceptable as it is a must in that field.
Maybe is it a bug in parsing strings in jdbc driver's internal methods?
I've tested all jdbc drivers version > 7.4
greets,
--
Alberto Rodriguez Galdo
argaldo@gmail.com
Re: possible bug
От:
Oliver Jowett <oliver@opencloud.com>
Дата:
Alberto Rodriguez Galdo wrote:
> This is the stackTrace:
>
> org.postgresql.util.PSQLException: ERROR: invalid message format
> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
> at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:314)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:306)
Can't reproduce this against 8.0.0 with the build 310 jar. Testcase
attached. What are you doing differently to this testcase? The schema I
used (in case it wasn't an error at the Parse stage) is:
test=# \d backupitem
Table "public.backupitem"
Column | Type | Modifiers
--------------+---------+-----------
idbackup | integer |
pathservidor | text |
pathoriginal | text |
hash | text |
esenlace | text |
metadatos | text |
You might want to try appending '?loglevel=2' to your connection URL;
that should generate screeds of debugging to stderr that may be useful
in debugging this. (send it to me off-list if it's large)
-O
import java.sql.*;
// Run with one argument: a JDBC url to connect to.
public class TestQuotes {
private static final String QUERY = "insert into backupItem (idbackup,pathservidor,pathoriginal,hash,esenlace,metadatos) values (null,'/home/argaldo/datos/software/tomcat/tomcat/webapps/ubt/backup/dani/null/home/argaldo/test/prueba','/home/argaldo/test/prueba','1C940736976FFFFFFFCFFFFFF866EFFFFFFECFFFFFF827EFFFFFFDC413F7FFFFFFAF76FFFFFFF967','false','\n \n 420\n 1000\n UNIX\n false\n false\n 1114629588\n 1000\n 1114644020\n \n\n')";
public static void main(String[] args) throws Exception {
Class.forName("org.postgresql.Driver");
Connection c = DriverManager.getConnection(args[0]);
Statement s = c.createStatement();
s.executeUpdate(QUERY);
c.close();
}
}