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 string '0 ' to type smallint or integer fails #3508

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

conversion of string '0 ' to type smallint or integer fails #3508

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

Comments

@monetdb-team
Copy link

Date: 2014-07-04 16:47:13 +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:02 +0100

Comment 19882

Date: 2014-07-04 16:47:13 +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:

Implicit conversion of strings '0 ' or ' 1234 ' or '123456 ' to type smallint or integer or bigint fails, but ' -1234' does not fail.

Reproducible: Always

Steps to Reproduce:

CREATE TABLE INT2_TBL(f1 smallint);
INSERT INTO INT2_TBL(f1) VALUES ('0 ');
INSERT INTO INT2_TBL(f1) VALUES (' 1234 ');

CREATE TABLE INT4_TBL(f1 integer);
INSERT INTO INT4_TBL(f1) VALUES (' 0 ');
INSERT INTO INT4_TBL(f1) VALUES ('123456 ');

Actual Results:

QUERY = INSERT INTO INT2_TBL(f1) VALUES ('0 ');
ERROR = !conversion of string '0 ' to type sht failed.

QUERY = INSERT INTO INT2_TBL(f1) VALUES (' 1234 ');
ERROR = !conversion of string ' 1234 ' to type sht failed.

QUERY = INSERT INTO INT4_TBL(f1) VALUES (' 0 ');
ERROR = !conversion of string ' 0 ' to type int failed.

QUERY = INSERT INTO INT4_TBL(f1) VALUES ('123456 ');
ERROR = !conversion of string '123456 ' to type int failed.

Expected Results:

These string with trailing spaces should be accepted in the implicit conversion from string to integer.
For instance the following inserts are accepted:
INSERT INTO INT2_TBL(f1) VALUES (' -1234');
INSERT INTO INT4_TBL(f1) VALUES (' -123456');

See sql/test/pg_regress/Tests/int2.sql
and sql/test/pg_regress/Tests/int4.sql

Comment 19883

Date: 2014-07-04 16:59:59 +0200
From: MonetDB Mercurial Repository <>

Changeset 1715d0918489 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=1715d0918489

Changeset description:

Converted castings of int2, int4, int8 to cast() syntax
Some tests fail in MonetDB which should not fail. See bug #3508
Updated stable.out and stable.err for int2, int4 and int8
Added substitution rules to the postgress2sql99.sh script

Comment 19885

Date: 2014-07-04 18:47:30 +0200
From: MonetDB Mercurial Repository <>

Changeset c47ea152d459 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=c47ea152d459

Changeset description:

Converted castings of float4 and float8 to cast() syntax
Some tests fail in MonetDB which should not fail. See bug #3508.
Updated stable.out and stable.err for float4 and float8
Added substitution rules to postgress2sql99.sh utility script

Comment 19886

Date: 2014-07-09 10:45:38 +0200
From: @njnes

current code indeed allows for leading spaces and not for trailing spaces.
Removing the code for allowing leading spaces is easy and will result in all example inserts to fail.

Comment 19942

Date: 2014-08-02 19:03:29 +0200
From: MonetDB Mercurial Repository <>

Changeset 9d7469c47ad8 made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

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

Changeset description:

fix for bug #3508, ie handle trailing spaces

Comment 20352

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

Oct2014 has been released.

@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