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

Computed decimal field in a view has wrong RDB$FIELD_PRECISION [CORE5550] #5818

Closed
firebird-automations opened this issue May 25, 2017 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @cincuranet

Steps to reproduce:

1. Create empty database.
2. "create view test(f) as select cast((select null from rdb$database) as decimal(10,2)) from rdb$database;"
3. "select rdb$field_precision, rdb$field_scale from rdb$fields where rdb$field_name='RDB$1';"

Result:
RDB$FIELD_PRECISION 0
RDB$FIELD_SCALE -2

Fails with decimal(2,2), decimal(18,4) as well (and probably with every other).

On 2.5.7 the RDB$FIELD_PRECISION is NULL. Not quite right either.

Commits: 9277af3 d334575

@firebird-automations
Copy link
Collaborator Author

Modified by: @cincuranet

Version: 2.5.7 [ 10770 ]

description: Steps to reproduce:

1. Create empty database.
2. "create view test(f) as select cast((select null from rdb$database) as decimal(10,2)) from rdb$database;"
3. "select rdb$field_precision, rdb$field_scale from rdb$fields where rdb$field_name='RDB$1';"

Result:
RDB$FIELD_PRECISION 0
RDB$FIELD_SCALE -2

Fails with decimal(2,2), decimal(18,4) as well (and probably with every other).

=>

Steps to reproduce:

1. Create empty database.
2. "create view test(f) as select cast((select null from rdb$database) as decimal(10,2)) from rdb$database;"
3. "select rdb$field_precision, rdb$field_scale from rdb$fields where rdb$field_name='RDB$1';"

Result:
RDB$FIELD_PRECISION 0
RDB$FIELD_SCALE -2

Fails with decimal(2,2), decimal(18,4) as well (and probably with every other).

On 2.5.7 the RDB$FIELD_PRECISION is NULL. Not quite right too.

@firebird-automations
Copy link
Collaborator Author

Modified by: @cincuranet

description: Steps to reproduce:

1. Create empty database.
2. "create view test(f) as select cast((select null from rdb$database) as decimal(10,2)) from rdb$database;"
3. "select rdb$field_precision, rdb$field_scale from rdb$fields where rdb$field_name='RDB$1';"

Result:
RDB$FIELD_PRECISION 0
RDB$FIELD_SCALE -2

Fails with decimal(2,2), decimal(18,4) as well (and probably with every other).

On 2.5.7 the RDB$FIELD_PRECISION is NULL. Not quite right too.

=>

Steps to reproduce:

1. Create empty database.
2. "create view test(f) as select cast((select null from rdb$database) as decimal(10,2)) from rdb$database;"
3. "select rdb$field_precision, rdb$field_scale from rdb$fields where rdb$field_name='RDB$1';"

Result:
RDB$FIELD_PRECISION 0
RDB$FIELD_SCALE -2

Fails with decimal(2,2), decimal(18,4) as well (and probably with every other).

On 2.5.7 the RDB$FIELD_PRECISION is NULL. Not quite right either.

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Note that a similar problem exists in Firebird 2.5 for computed columns in 'real' tables, but that has been fixed in Firebird 3.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Note that precision passed in the CAST datatype will not picked (as in table's computed field defined without declaring its type), as Firebird does not pass on this definition to the needed place.

The calculated precision will be the max. precision for the underlying (short, int, int64) datatype used.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

Fix Version: 3.0.3 [ 10810 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Version: 4.0 Initial [ 10621 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

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