DatabaseMetaData.getColumns() doesn't work correctly when using index-based getters #3356
Date: 2013-09-02 18:49:39 +0200
Last updated: 2013-10-22 14:42:08 +0200
Date: 2013-09-02 18:49:39 +0200
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0
When retrieving details about the columns of a table, the driver does not return the correct information when the index based getters are used rather than the getters that provide a column name.
ResultSet rs = connection.getMetaData().getColumns("demo", "voc", "invoices", "%");
The same is true for getInt("DECIMAL_DIGITS") vs. getInt(9)
Steps to Reproduce:
getString(18) returns null
getString(18) should return the same value as getString("IS_NULLABLE")
I have observed this behaviour with the JDBC driver versions 2.8 and 2.9 against a MonetDB Server 11.15.3
Date: 2013-09-02 19:42:45 +0200
from http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.htmlgetColumns%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%29 I cannot deduce that the column mapping should be exactly as the specification says
Date: 2013-09-02 20:23:42 +0200
Next to each column name there is the index number where that column is supposed to be.
Using the index works in all other DBMS (Oracle, Postgres, SQL Server, DB2, H2, HSQLDB, Derby, Teradata, Cubrid, MySQL, Firebird, Ingres, Informix, NuoDB, SQLite, Vertica, even Excel and Access through ODBC)
Date: 2013-09-03 09:54:08 +0200
Created attachment 229
I reordered columns in metadata query in getColumns method and fixed couple column number (adding 1) in metadate methods.
Date: 2013-09-03 10:03:04 +0200
Can you please attach a patch? I think the changes are fine, but can't easily check from here/this way.
Date: 2013-09-03 10:09:16 +0200
Created attachment 230
Hopefully the patch is in the right direction.
Date: 2013-09-04 10:44:18 +0200
Changes look OK to me. I assume they pass the tests?
Date: 2013-09-04 15:14:18 +0200
(In reply to comment 6)
I did not run any tests included in the source code tree.
Date: 2013-09-05 16:40:45 +0200
Created attachment 231
I'm sorry for bugging. I found another glitch in the MetaData. Method keyQuery did not return the columns in the other described in JDBC specification. It caused method getImportedKeys and others to malfunction in SQL Workbench.
Date: 2013-09-05 18:20:06 +0200
I cannot apply your patch:
patch unexpectedly ends in middle of line
Date: 2013-09-05 18:24:07 +0200
(In reply to comment 9)
ignore that, I no longer understand BugZilla's buttons/links/output
Date: 2013-09-05 18:53:57 +0200
(In reply to comment 8)
your patch breaks Test_JdbcClient on the foreign key constraint dumping, so something is no longer matching
Date: 2013-09-05 21:50:01 +0200
I'm not able to compile tests with Java 1.7.0_25:
Total time: 1 second
Date: 2013-10-04 15:42:39 +0200
For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=868919fa3005
Date: 2013-10-04 15:44:25 +0200
Assuming that the patch does indeed fix the problem, I'm closing this.
Date: 2013-10-04 21:02:00 +0200
(In reply to comment 14)
as noted in comment 11, the patch breaks the constraint dumping test, e.g.
Date: 2013-10-04 21:03:20 +0200
Date: 2013-10-05 10:55:28 +0200
For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=4e1be37a5d65
Date: 2013-10-07 17:32:29 +0200
For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=6ba6b5e2f37f
Date: 2013-10-07 17:33:06 +0200
Fixed with a smaller patch than the original.
The text was updated successfully, but these errors were encountered: