From: | innuendo-nh(at)libero(dot)it <innuendo-nh(at)libero(dot)it> |
---|---|
To: | pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | I found a bug in the jdbc driver |
Date: | 2003-05-22 13:57:06 |
Message-ID: | HFAK36$29CA7B071D719D6E1A683B9A564D0E9F@libero.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I have just found a bug in the latest jdbc driver.
The error is in the class org.postgresql.jdbc2.AbstractJdbc2ResultSet
the method parseQuery() has a bug:
if you give as sql query something like "SELECT * FROM tablename;", that is a
valid sql statement, and you try to use a resultset update method (like
updateInt()), you receive an SQLException saying: No Primary Keys. this is
because the method parseQuery() make a too simplified use of the
StringTokenizer, so the variable tableName is set at something like this:
"tablename;". So when the isUpdateable() method request for the primary keys of
the table 'tablename;', postgres answers there are no rows (it can't fond any
primary key for the table because it doesn't exists). The problem can be
resolved writing the sql statement very carefully: you must insert blanks
between any part of the sql statement (operators, keywords, ecc.). In my example
the solution is to insert a blank before the semicolon ("SELECT * FROM tablename
;").
I think i can resolve the problem, modifying the driver, but i wuold be glad to
know if someone else is already working at it now.
I hope this can be useful.
Inny.
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Nasser | 2003-05-22 14:59:52 | JDBC: Better initial capacity for StringBuffers reduces memory usage |
Previous Message | Andrew Sullivan | 2003-05-21 20:32:22 | Re: Connections performance is reduced |