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

Bad storage of Numeric values [CORE1350] #1769

Closed
firebird-automations opened this issue Jul 10, 2007 · 5 comments
Closed

Bad storage of Numeric values [CORE1350] #1769

firebird-automations opened this issue Jul 10, 2007 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Martin Pavlik (quitec)

Numeric values are stored with higher precision than declared. Such values are not visible by a simple select, but become visible when multiplied by a bigger number.

Example:
- declaration of variable N in table T is Numeric(15,2)
- update T set N =0.001234 where ID=1 sets variable to an invisible value
- select N from T where ID=1 returns 0.00 as expected
- select N*10000 from T where ID=1 returns 12.34 which is WRONG!

This gives unexpected results for example when calculating unit price * volume = total price,
because 0.00 * something should be 0.00 and not something else.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

What is the database dialect? It looks like it's Dialect 1. It you want exact numerics, you should be using Dialect 3, otherwise all numerics are approximate.

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

This is expected and well documented behaviour for legacy SQL DIALECT 1 databases. Exact (large) numerics require SQL DIALECT 3, which is the default dialect for new databases since Firebird 0.9.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Martin Pavlik (quitec)

Yes, I use SQL dialect 1 in this case.
I see, I will have to switch to dialect 3 in my projects.
Thanks.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 12530 ] => Firebird [ 14143 ]

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