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

conversion of whitespaces string to double or float is accepted without an error during insert #3691

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2015-03-26 18:42:22 +0100
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: 11.19.9 (Oct2014-SP2)

Last updated: 2015-05-07 12:37:32 +0200

Comment 20747

Date: 2015-03-26 18:42:22 +0100
From: Martin van Dinther <<martin.van.dinther>>

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

conversion of whitespaces string to double or float is accepted without an error during insert

Reproducible: Always

Steps to Reproduce:

  1. Start mserver5 (MonetDB v11.19.9 (Oct2014-SP2))
  2. Start mclient
  3. execute SQL commands:
    CREATE TABLE DOUBLE_TBL(f1 double);
    INSERT INTO DOUBLE_TBL(f1) VALUES (' ');
    INSERT INTO DOUBLE_TBL(f1) VALUES ('\t');
    INSERT INTO DOUBLE_TBL(f1) VALUES ('\n');
    INSERT INTO DOUBLE_TBL(f1) VALUES (' \t \t\t \n ');
    SELECT f1 FROM DOUBLE_TBL;
    -- lists 4 rows with all null
    INSERT INTO DOUBLE_TBL(f1) VALUES ('');
    -- this fails

CREATE TABLE FLOAT_TBL(f1 float);
INSERT INTO FLOAT_TBL(f1) VALUES (' ');
INSERT INTO FLOAT_TBL(f1) VALUES ('\t');
INSERT INTO FLOAT_TBL(f1) VALUES ('\n');
INSERT INTO FLOAT_TBL(f1) VALUES (' \t \t\t \n ');
SELECT f1 FROM FLOAT_TBL;
-- lists 4 rows with all null
INSERT INTO FLOAT_TBL(f1) VALUES ('');
-- this fails

Actual Results:

Welcome to mclient, the MonetDB/SQL interactive terminal (unreleased)
Database: MonetDB v11.19.9 (Oct2014-SP2), 'demo'
Type \q to quit, ? for a list of available commands
auto commit mode: on
sql>CREATE TABLE DOUBLE_TBL(f1 double);
operation successful (7.731ms)
sql>INSERT INTO DOUBLE_TBL(f1) VALUES (' ');
1 affected row (0.542ms)
sql>INSERT INTO DOUBLE_TBL(f1) VALUES ('\t');
1 affected row (0.308ms)
sql>INSERT INTO DOUBLE_TBL(f1) VALUES ('\n');
1 affected row (0.324ms)
sql>INSERT INTO DOUBLE_TBL(f1) VALUES (' \t \t\t \n ');
1 affected row (0.660ms)
sql>SELECT f1 FROM DOUBLE_TBL;
+--------------------------+
| f1 |
+==========================+
| null |
| null |
| null |
| null |
+--------------------------+
4 tuples (1.040ms)
sql>INSERT INTO DOUBLE_TBL(f1) VALUES ('');
conversion of string '' to type dbl failed.
sql>

Welcome to mclient, the MonetDB/SQL interactive terminal (unreleased)
Database: MonetDB v11.19.9 (Oct2014-SP2), 'demo'
Type \q to quit, ? for a list of available commands
auto commit mode: on
sql>CREATE TABLE FLOAT_TBL(f1 float);
operation successful (1.506ms)
sql>INSERT INTO FLOAT_TBL(f1) VALUES (' ');
1 affected row (0.777ms)
sql>INSERT INTO FLOAT_TBL(f1) VALUES ('\t');
1 affected row (0.531ms)
sql>INSERT INTO FLOAT_TBL(f1) VALUES ('\n');
1 affected row (0.509ms)
sql>INSERT INTO FLOAT_TBL(f1) VALUES (' \t \t\t \n ');
1 affected row (0.745ms)
sql>SELECT f1 FROM FLOAT_TBL;
+--------------------------+
| f1 |
+==========================+
| null |
| null |
| null |
| null |
+--------------------------+
4 tuples (1.731ms)
sql>INSERT INTO FLOAT_TBL(f1) VALUES ('');
conversion of string '' to type dbl failed.
sql>

Expected Results:

strings with only whitespace characters do not represent a number and therefore should result in an error, like when the string has length 0.

In default branch the behavior for whitespace string to float has recently changed and it now returns an error.

Comment 20751

Date: 2015-03-31 11:31:51 +0200
From: MonetDB Mercurial Repository <>

Changeset 476a699b2b1e 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=476a699b2b1e

Changeset description:

Fix for bug #3691 by using basically same code for dbl as for flt.

Comment 20754

Date: 2015-04-02 13:31:30 +0200
From: MonetDB Mercurial Repository <>

Changeset c64098b19544 made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the MonetDB repo, refers to this bug.

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

Changeset description:

Updated and approved new outputs after fix for bug #3691

Comment 20755

Date: 2015-04-02 13:31:38 +0200
From: MonetDB Mercurial Repository <>

Changeset 543a90055d48 made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the MonetDB repo, refers to this bug.

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

Changeset description:

Updated float8.sql outputs after fix 3691

Comment 20763

Date: 2015-04-08 14:14:35 +0200
From: @sjoerdmullender

It's NEXTRELEASE until the release.

@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants