Issue Details (XML | Word | Printable)

Key: CORE-2362
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Andre van Zuydam
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Numeric or Decimal Computed Field SubType has Incorrect Value

Created: 10/Mar/09 03:47 PM   Updated: 28/Aug/15 06:05 PM
Component/s: API / Client Library
Affects Version/s: 2.1.1
Fix Version/s: None

Environment: Windows, Linux, Delphi, PHP


 Description  « Hide
Please run the following SQL and you will notice that the computed by field has a difference in the RDB$FIELD_SUB_TYPE & RDB$FIELD_PRECISION columns. Surely the computed field should inherit the properties of the fields it is using for its calculation.


create table example (
  field1 numeric (10,2) default 0,
  field2 numeric (10,2) default 0,
  total computed by (field1 + field2)
);

commit;

SELECT a.RDB$RELATION_NAME, a.RDB$FIELD_NAME, b. RDB$FIELD_LENGTH, b.RDB$FIELD_SCALE, c.RDB$TYPE_NAME, b.RDB$FIELD_TYPE, b.RDB$FIELD_SUB_TYPE, b.RDB$FIELD_PRECISION, b.RDB$COMPUTED_SOURCE
FROM RDB$RELATION_FIELDS a JOIN RDB$FIELDS b ON (b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE)
LEFT JOIN RDB$TYPES c ON (b.RDB$FIELD_TYPE = c.RDB$TYPE and c.RDB$FIELD_NAME = 'RDB$FIELD_TYPE')
WHERE a.RDB$RELATION_NAME = 'EXAMPLE' ORDER BY a.RDB$RELATION_NAME, a.RDB$FIELD_POSITION



 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Gabriel added a comment - 28/Aug/15 06:04 PM - edited
I think this bug (is it a bug or expected behaviour?) is related to issue 152 (http://tracker.firebirdsql.org/browse/CORE-152).

Another way of reproducing:
isql> set sqlda_display;
isql> select cast(1.5 as numeric(10,2)) + cast(0.5 as numeric(10,2)) from rdb$databse;

as you can see, resulting subtype is 0, instead of 1.