create table TEST (
C computed by (A+B)
than when wi have Java code:
PreparedStatement statement = conn.prepareStatement ("select * from TEST");
ResultSet retVal = statement.executeQuery();
FBResultSetMetaData metaData = (FBResultSetMetaData) sqlResultSet.getMetaData();
int i = index of C column;
//This column returns ZERO
The caused by a bug in Firebird 2.5, which has been fixed in Firebird 3. The problem is that Firebird 2.5 reports the field as precision 0; you can see this for yourself in RDB$FIELDS, eg using: select * from RDB$FIELDS where RDB$COMPUTED_SOURCE = '(A+B)'.
I can probably work around this problem by 'estimating' the precision if it is reported as zero; the estimated precision would be 19 (and not 18).
We made a similar workaround directly in our Java application too. I must appologize that I did not explore this bug in deep before reporting it. I did not check whether it is correct in firebird system tables.
Fixed for 2.2.12 and 3.0. The estimate for 2.2.12 will be 19, for 3.0 it will be 18 (which is more correct).
The primary reason to use 19 in 2.2.12 is that we already estimated the precision in some cases and that used 19; changing it to 18 would have been a (potentially) breaking change which I didn't want to do in a point release. This estimation had already been revised to 18 in 3.0.