incorrect values for DatabaseMetaData.getColumns()
От | Craig Longman |
---|---|
Тема | incorrect values for DatabaseMetaData.getColumns() |
Дата | |
Msg-id | 1023544534.25760.135.camel@jigra.begeek.com обсуждение исходный текст |
Список | pgsql-jdbc |
i have been using jdbc to write a quick little database comparison program for me to compare the table structure of a number of different databases to make sure they're all in sync, and noticed that the pgsql driver doesn't provide the correct information for one of the columns in the ResultSet returned by DatabaseMetaData.getColumns(). the jdbc docs i have say this: 7. COLUMN_SIZE int => column size. For char or date types, this is the maximum number of characters, __for numeric or decimal types this is precision___. the __ emphasize the lines in question. when i use this column on a pgsql database (7.2 driver, 7.2 and 7.1 servers) the number returned is '4', not the expected '10' for an integer field. it seems like its returning the storage space (or bytes) that the field takes up, not the precision that the field can handle. also, it returns odd values (-1) for things like long varchar fields and floating fields. i guess -1 is a more acceptable answer rather than an incorrect answer. anyway, i'm sure this isn't used all that frequently, but i wanted to point it out. it has made comparing anything but the names of a pgsql database impossible, every field (except normal varchar fields) are showing up as changed because the lengths returned are wrong. cheers, -- CraigL->Thx(); Be Developer ID: 5852
Вложения
В списке pgsql-jdbc по дате отправления: