New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DatabaseMetadata.getColumn returns 0 for DECIMAL_DIGITS [JDBC426] #467
Comments
Commented by: @mrotteveel Jaybird has tests for this (TestFBDatabaseMetaDataColumns) and those don't fail. What is the exact CREATE TABLE you have used, and is the numeric column defined through a domain or directly? And is your database dialect 1 or dialect 3? Also: 2.5.1 is pretty old (and a lot of bugs have been fixed since then). |
Commented by: @mrotteveel I have just tested this with a domain and without a domain, and with dialect 1 and dialect 3, and DECIMAL_DIGITS returns 2 as expected. |
Commented by: @mrotteveel What do you get for this query: SELECT RF.RDB$RELATION_NAME AS RELATION_NAME, |
Commented by: Steve Peterson (speterson) Thanks for taking a look. The database is SQL dialect 1 -- sorry, it is a legacy system. We created a table called, 'PRICESTORE' using the following: CREATE TABLE PRICESTORE For the above metadata query, I get the below results. The field with the problem is "PRICE". PRICESTORE PRODID 8 0 0 0 4 [null] |
Commented by: @mrotteveel The test I created earlier seems to have been using dialect 3 even though I created a dialect 1 database. The problem is that the metadata is 'wrong' the NUMERIC(15,2) looks like a DOUBLE PRECISION to Jaybird because the subtype is NULL, I can reproduce this when I create it manually in dialect 1. I seem to have broken it between 2.1.6 and 2.2.0, specifically by commit d9a2235 |
Modified by: @mrotteveelVersion: Jaybird 2.2.9 [ 10691 ] Version: Jaybird 2.2.8 [ 10664 ] Version: Jaybird 2.2.7 [ 10660 ] Fix Version: Jaybird 2.2.11 [ 10751 ] Fix Version: Jaybird 3.0 [ 10440 ] |
Commented by: @mrotteveel Fixed for Jaybird 2.2.11 |
Modified by: @mrotteveelstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Steve Peterson (speterson)
I get metadata for a column of type NUMERIC(15,2), then look at the column DECIMAL_DIGITS, it returns 0; it used to return "2" because that is how many digits to the right of the decimal are in the field. So when I run something like the below program the entry for MYNUMERICCOLUMN that is of type Numeric(15,2) says:
...MYNUMERICCOLUMN, p=15, scale=0
DatabaseMetaData md = connection.getMetaData();
ResultSet r = md.getColumns(null, null,"MYTABLETNAME", "%");
//Loop through each entry to get the metadata for each column in table
while ((r != null) && (r.next())) {
String columnName = r.getString("COLUMN_NAME");
int precision = r.getInt("COLUMN_SIZE");
int scale = r.getShort("DECIMAL_DIGITS");
System.out.prinln(columnName + "p=" + precision + ", scale=" + scale)
}
Commits: bd224c1 4a46817
The text was updated successfully, but these errors were encountered: