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

casting strings with more than one trailing zero ('0') to decimal goes wrong #6206

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2017-02-08 01:43:02 +0100
From: @drstmane
To: SQL devs <>
Version: 11.25.5 (Dec2016-SP1)
CC: @njnes

Last updated: 2017-03-03 10:24:31 +0100

Comment 24984

Date: 2017-02-08 01:43:02 +0100
From: @drstmane

sql>select cast(1 as decimal(7,3));
+-----------+
| L2 |
+===========+
| 1.000 |
+-----------+
1 tuple (1.115ms)
sql>select cast('1' as decimal(7,3));
+-----------+
| L2 |
+===========+
| 1.000 |
+-----------+
1 tuple (1.064ms)
sql>select cast(10 as decimal(7,3));
+-----------+
| L2 |
+===========+
| 10.000 |
+-----------+
1 tuple (1.100ms)
sql>select cast('10' as decimal(7,3));
+-----------+
| L2 |
+===========+
| 10.000 |
+-----------+
1 tuple (1.036ms)
sql>select cast(100 as decimal(7,3));
+-----------+
| L2 |
+===========+
| 100.000 |
+-----------+
1 tuple (0.997ms)
sql>select cast('100' as decimal(7,3));
+-----------+
| L2 |
+===========+
| 10.000 |
+-----------+
1 tuple (0.953ms)
sql>select cast(110 as decimal(7,3));
+-----------+
| L2 |
+===========+
| 110.000 |
+-----------+
1 tuple (1.073ms)
sql>select cast('110' as decimal(7,3));
+-----------+
| L2 |
+===========+
| 110.000 |
+-----------+
1 tuple (1.056ms)
sql>select cast(1000 as decimal(7,3));
+-----------+
| L2 |
+===========+
| 1000.000 |
+-----------+
1 tuple (0.970ms)
sql>select cast('1000' as decimal(7,3));
+-----------+
| L2 |
+===========+
| 10.000 |
+-----------+
1 tuple (1.063ms)
sql>select cast(1100 as decimal(7,3));
+-----------+
| L2 |
+===========+
| 1100.000 |
+-----------+
1 tuple (1.115ms)
sql>select cast('1100' as decimal(7,3));
+-----------+
| L2 |
+===========+
| 110.000 |
+-----------+
1 tuple (1.409ms)
sql>select cast(1110 as decimal(7,3));
+-----------+
| L2 |
+===========+
| 1110.000 |
+-----------+
1 tuple (1.038ms)
sql>select cast('1110' as decimal(7,3));
+-----------+
| L2 |
+===========+
| 1110.000 |
+-----------+
1 tuple (1.084ms)

Comment 24987

Date: 2017-02-08 13:01:15 +0100
From: @njnes

the problem is caused by the evaluate optimizer

Comment 24988

Date: 2017-02-08 13:09:21 +0100
From: MonetDB Mercurial Repository <>

Changeset 1a49ca7de68d made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=1a49ca7de68d

Changeset description:

Only remove trailing zeros if there is a decimal point.
This fixes bug #6206.

Comment 24989

Date: 2017-02-08 13:10:17 +0100
From: @sjoerdmullender

Sorry, Niels, it was still a bug in the SQL part.

Comment 24990

Date: 2017-02-08 14:00:07 +0100
From: MonetDB Mercurial Repository <>

Changeset 827563bf5dcc made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=827563bf5dcc

Changeset description:

Added test for bug #6206.

Comment 25119

Date: 2017-03-03 10:24:31 +0100
From: @sjoerdmullender

Dec2016-SP2 has been released, incorporating the fix.

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

Successfully merging a pull request may close this issue.

None yet
1 participant