Skip to content
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

Numeric or Decimal Computed Field SubType has Incorrect Value [CORE2362] #2785

Open
firebird-automations opened this issue Mar 10, 2009 · 1 comment

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Andre van Zuydam (andrevanzuydam)

Votes: 1

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

@firebird-automations
Copy link
Collaborator Author

Commented by: Gabriel (gabrielf)

I think this bug (is it a bug or expected behaviour?) is related to issue 152 (CORE152).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant