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

SQLGetInfo returns incorrect value for SQL_FN_NUM_TRUNCATE #3431

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

SQLGetInfo returns incorrect value for SQL_FN_NUM_TRUNCATE #3431

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

Comments

@monetdb-team
Copy link

Date: 2014-02-04 22:01:21 +0100
From: Ken Leese <<ken.leese>>
To: clients devs <>
Version: 11.17.9 (Jan2014)

Last updated: 2014-02-20 15:02:32 +0100

Comment 19531

Date: 2014-02-04 22:01:21 +0100
From: Ken Leese <<ken.leese>>

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Build Identifier:

The ODBC SqlGetInfo function with parameter SQL_NUMERIC_FUNCTIONS currently returns SQL_FN_NUM_TRUNCATE. Apparently the current MonetDB TRUNCATE function is not a NUMERIC function, but instead a STRING function.

http://msdn.microsoft.com/en-us/library/ms711743(v=vs.85).aspx describes the ODBC-compliant behaviour of the numeric TRUNCATE function.

If a numeric TRUNC() function is not available (and supported through the ODBC "{fn...}" syntax), then SqlGetInfo should not return SQL_FN_NUM_TRUNCATE.

Reproducible: Always

Steps to Reproduce:

CREATE TABLE "test" ("built_numeric" NUMERIC(6,2));
INSERT INTO "test" VALUES (1700.2);
INSERT INTO "test" VALUES (1700.4);
INSERT INTO "test" VALUES (1760.9);
SELECT {fn TRUNCATE(built_numeric, 3)} AS "trunc_numeric" FROM "test";

Actual Results:

Values are "170", "170", "176"

Expected Results:

Values should be "1700.2", "1700.4", and "1760.9".

Support for numeric TRUNC() would be desirable since it would enhance compatibility with widely available data visualization offerings.
The current behaviour (in which the ODBC driver claims support for a feature not supported by the database) causes third-party ODBC client failure in a non-recoverable manner.

The failing scenario was tested after rebuilding the Windows ODBC driver from recent source that includes the enhancement described in bug #3092 "support scalar function escape"

Comment 19535

Date: 2014-02-05 09:50:14 +0100
From: MonetDB Mercurial Repository <>

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

Changeset description:

Our truncate function in SQL is not the numeric kind.
This fixes bug #3431.

Comment 19536

Date: 2014-02-05 09:53:13 +0100
From: @sjoerdmullender

An even better fix would of course be to implement the numeric truncate.

Comment 19551

Date: 2014-02-05 23:03:04 +0100
From: MonetDB Mercurial Repository <>

Changeset 08a368407b9b 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=08a368407b9b

Changeset description:

It turns out we do have a function for {fn truncate(...)}.
The function is just not called truncate, but ms_trunc.
See bug #3431 and changeset [ae06f23df9b5](https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ae06f23df9b5) 

Comment 19596

Date: 2014-02-20 15:02:32 +0100
From: @sjoerdmullender

Jan2014 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Client interfaces normal
Projects
None yet
Development

No branches or pull requests

2 participants