Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-115

Message wrong. Numeric data type report "String data, right-truncated"

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.0.15
    • 3.0.2, 2.0.16
    • None
    • None
    • DB2 linuxamd64
      MariaDB v10

    Description

      When DB2 using mariadb-connector-odbc-2.0.15-ga-rhel6-x86_64.tar.gz connect to Mariadb 10.0.31, we create a bigint unsigned on maraidb table, insert a data larger than DB2 bigint 9223372036854807, such as 9223372036854809

      create table table(col1 bigint unsigned);
      insert into table values(9223372036854809);

      select * form table(on DB2 which is connected with maraidb via odbc connector)

      ODBC trace is as following:

      EXIT SQLFetch with return code 1 (SQL_SUCCESS_WITH_INFO)
      HSTMT 0x0069f960

      ENTER SQLGetDiagRec
      SQLSMALLINT 3
      SQLHANDLE 0x0069f960
      SQLSMALLINT 1
      SQLCHAR * 0x5c2c285e (NYI)
      SQLINTEGER * 0x5c2c2058
      SQLCHAR * 0x5c2c205c (NYI)
      SQLSMALLINT 1025
      SQLSMALLINT * 0x5c2c1f12

      EXIT SQLGetDiagRec with return code 0 (SQL_SUCCESS)
      SQLSMALLINT 3
      SQLHANDLE 0x0069f960
      SQLSMALLINT 1
      SQLCHAR * 0x5c2c285e [ 5] "01004"
      SQLINTEGER * 0x5c2c2058 (0)
      SQLCHAR * 0x5c2c205c [ 56] "[ma-2.0.15][10.0.31-MariaDB]String data, right-truncated"
      SQLSMALLINT 1025
      SQLSMALLINT * 0x5c2c1f12 (56)

      We think the error message is wrong, it should be 22003, because the datatype is numeric not Sting data.

      https://mariadb.com/kb/en/library/sql-99/error-sqlstates/

      22003 data exception-numeric value out of range

      Suggested error message: "the numeric value <> is too big to fit in the target <>". Often this is the result of an arithmetic overflow — for example, "UPDATE ... SET SMALLINT_COLUMN = 9999999999", or you're trying to retrieve a value of 5 billion into a host variable defined in Pascal as "Word". Fractional truncation won't cause this error, see SQLSTATE 01S07

      Attachments

        Issue Links

          Activity

            For numeric overflow we now set SQL state 22003, and return corresponding to this state SQL_ERROR. Also for fractional truncation the sql state is 01S07 now.
            The fix and the testcase have been pushed to the odbc-2.0 branch as commit 69d2299ed5c0182b3a5e32b3d268ac05050011ff, and to the odbc-3.0 - as f7904119868ed012cfca30f186d1c3fe5c750548

            Lawrin Lawrin Novitsky added a comment - For numeric overflow we now set SQL state 22003, and return corresponding to this state SQL_ERROR. Also for fractional truncation the sql state is 01S07 now. The fix and the testcase have been pushed to the odbc-2.0 branch as commit 69d2299ed5c0182b3a5e32b3d268ac05050011ff, and to the odbc-3.0 - as f7904119868ed012cfca30f186d1c3fe5c750548

            People

              Lawrin Lawrin Novitsky
              malloc8 haijun
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.