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

inserting '0' into a column of datatype numeric fails #3516

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

inserting '0' into a column of datatype numeric fails #3516

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

Comments

@monetdb-team
Copy link

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

Date: 2014-07-18 18:34:41 +0200
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: 11.17.17 (Jan2014-SP2)
CC: @njnes

Last updated: 2014-10-31 14:14:01 +0100

Comment 19916

Date: 2014-07-18 18:34:41 +0200
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0
Build Identifier:

CREATE TABLE num_data (id integer, val numeric(18,10));
INSERT INTO num_data VALUES (0, '0');

Reproducible: Always

Steps to Reproduce:

  1. Start mserver5
  2. Start mclient
    Welcome to mclient, the MonetDB/SQL interactive terminal (unreleased)
    Database: MonetDB v11.17.17 (Jan2014-SP2), 'demo'
    Type \q to quit, ? for a list of available commands
    auto commit mode: on
    sql>CREATE TABLE num_data (id integer, val numeric(18,10));
    operation successful (3.116ms)
    sql>INSERT INTO num_data VALUES (0, '0');
    "" is no decimal value (doesn't contain a '.')

sql>INSERT INTO num_data VALUES (1, '0.0');
1 affected rows (2.551ms)
sql>INSERT INTO num_data VALUES (2, 0);
1 affected rows (1.947ms)
sql>INSERT INTO num_data VALUES (3, 0.0);
1 affected rows (1.975ms)
sql>SELECT * FROM num_data;
+------+----------------------+
| id | val |
+======+======================+
| 1 | 0.0000000000 |
| 2 | 0.0000000000 |
| 3 | 0.0000000000 |
+------+----------------------+
3 tuples (1.043ms)
sql>

Actual Results:

Error: "" is no decimal value (doesn't contain a '.')

Expected Results:

It should not give an error when the numeric string value did not included a decimal dot character. It should accept it.

following insert statements are accepted:
INSERT INTO num_data VALUES (1, '0.');
INSERT INTO num_data VALUES (1, '0.0');
INSERT INTO num_data VALUES (2, 0);
INSERT INTO num_data VALUES (3, 0.0);

Comment 19944

Date: 2014-08-04 18:29:11 +0200
From: @njnes

we now allow for decimals without '.'.

Comment 20081

Date: 2014-08-22 16:00:02 +0200
From: Martin van Dinther <<martin.van.dinther>>

Problem still occurs for huge decimals such as numeric(38,10).

CREATE TABLE num38_data (val numeric(38,10));
INSERT INTO num38_data VALUES ('0');
INSERT INTO num38_data VALUES ('1234567890');

It appears to be corrected in
sql/backends/monet5/sql_round_impl.h str_2dec()
but not yet in
sql/backends/monet5/sql_round.c str_2dec_hge()
See above additional test case.

Comment 20350

Date: 2014-10-31 14:14:01 +0100
From: @sjoerdmullender

Oct2014 has been released.

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