Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12520

ConnectSE truncating data on DECIMAL column

Details

    Description

      The Connect engine is doing some strange things for a DECIMAL column.

      It starts off normal:

      MariaDB [test]> CREATE TABLE connect14007 ( id INT PRIMARY KEY AUTO_INCREMENT, foo DECIMAL(18,3));
      Query OK, 0 rows affected (0.02 sec)
       
      MariaDB [test]> CREATE TABLE connect14007j ENGINE=CONNECT TABLE_TYPE=JDBC TABNAME=connect14007 CONNECTION='jdbc:mysql://localhost/test?user=root';
      Query OK, 0 rows affected (0.02 sec)
       
      MariaDB [test]> INSERT INTO connect14007 ( foo ) VALUES ( 1234567890.123 );
      Query OK, 1 row affected (0.09 sec)
       
      MariaDB [test]> SELECT 'MariaDB', foo FROM connect14007 UNION ALL SELECT 'Connect', foo FROM connect14007j;
      +---------+----------------+
      | MariaDB | foo            |
      +---------+----------------+
      | MariaDB | 1234567890.123 |
      | Connect | 1234567890.123 |
      +---------+----------------+
      2 rows in set (0.01 sec)
       
      MariaDB [test]> 
      

      Until we add one more number (10x):

      MariaDB [test]> INSERT INTO connect14007 ( foo ) VALUES ( 12345678901.123 );
      Query OK, 1 row affected (0.00 sec)
       
      MariaDB [test]> SELECT 'MariaDB', foo FROM connect14007 UNION ALL SELECT 'Connect', foo FROM connect14007j;
      +---------+-----------------+
      | MariaDB | foo             |
      +---------+-----------------+
      | MariaDB |  1234567890.123 |
      | MariaDB | 12345678901.123 |
      | Connect |  1234567890.123 |
      | Connect | 12345678901.123 |
      +---------+-----------------+
      4 rows in set, 1 warning (0.00 sec)
       
      MariaDB [test]> SHOW WARNINGS;
      +-------+------+------------------------------------------+
      | Level | Code | Message                                  |
      +-------+------+------------------------------------------+
      | Note  | 1265 | Data truncated for column 'foo' at row 2 |
      +-------+------+------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> 
      

      We can do this three more times:

      MariaDB [test]> SELECT 'MariaDB', foo FROM connect14007 UNION ALL SELECT 'Connect', foo FROM connect14007j;
      +---------+--------------------+
      | MariaDB | foo                |
      +---------+--------------------+
      | MariaDB |     1234567890.123 |
      | MariaDB |    12345678901.123 |
      | MariaDB |   123456789012.123 |
      | MariaDB |  1234567890123.123 |
      | MariaDB | 12345678901234.123 |
      | Connect |     1234567890.123 |
      | Connect |    12345678901.123 |
      | Connect |   123456789012.123 |
      | Connect |  1234567890123.123 |
      | Connect | 12345678901234.123 |
      +---------+--------------------+
      10 rows in set, 4 warnings (0.01 sec)
       
      MariaDB [test]> show warnings;
      +-------+------+------------------------------------------+
      | Level | Code | Message                                  |
      +-------+------+------------------------------------------+
      | Note  | 1265 | Data truncated for column 'foo' at row 2 |
      | Note  | 1265 | Data truncated for column 'foo' at row 3 |
      | Note  | 1265 | Data truncated for column 'foo' at row 4 |
      | Note  | 1265 | Data truncated for column 'foo' at row 5 |
      +-------+------+------------------------------------------+
      4 rows in set (0.00 sec)
       
      MariaDB [test]>  
      

      And the fifth one somehow changes the decimal value:

      MariaDB [test]> INSERT INTO connect14007 ( foo ) VALUES ( 123456789012345.123 );
      Query OK, 1 row affected (0.00 sec)
       
      MariaDB [test]> SELECT 'MariaDB', foo FROM connect14007 UNION ALL SELECT 'Connect', foo FROM connect14007j;
      +---------+---------------------+
      | MariaDB | foo                 |
      +---------+---------------------+
      | MariaDB |      1234567890.123 |
      | MariaDB |     12345678901.123 |
      | MariaDB |    123456789012.123 |
      | MariaDB |   1234567890123.123 |
      | MariaDB |  12345678901234.123 |
      | MariaDB | 123456789012345.123 |
      | Connect |      1234567890.123 |
      | Connect |     12345678901.123 |
      | Connect |    123456789012.123 |
      | Connect |   1234567890123.123 |
      | Connect |  12345678901234.123 |
      | Connect | 123456789012345.125 |
      +---------+---------------------+
      12 rows in set, 4 warnings (0.00 sec)
       
      MariaDB [test]> SHOW WARNINGS;
      +-------+------+------------------------------------------+
      | Level | Code | Message                                  |
      +-------+------+------------------------------------------+
      | Note  | 1265 | Data truncated for column 'foo' at row 2 |
      | Note  | 1265 | Data truncated for column 'foo' at row 3 |
      | Note  | 1265 | Data truncated for column 'foo' at row 4 |
      | Note  | 1265 | Data truncated for column 'foo' at row 5 |
      +-------+------+------------------------------------------+
      4 rows in set (0.00 sec)
       
      MariaDB [test]> 
      

      Attachments

        Issue Links

          Activity

            wfong Will Fong added a comment -

            Hi bertrandop, Will we be able to get this into 10.2 line? Thanks!

            wfong Will Fong added a comment - Hi bertrandop , Will we be able to get this into 10.2 line? Thanks!

            bertrandop I'm trying to track down the git commit for this change, can't find it via 'git log'.

            alvinr Alvin Richards (Inactive) added a comment - bertrandop I'm trying to track down the git commit for this change, can't find it via 'git log'.

            I pushed the fix quite recently. It will appear only when new versions will be issued providing the fixed CONNECT is correctly included in them

            bertrandop Olivier Bertrand added a comment - I pushed the fix quite recently. It will appear only when new versions will be issued providing the fixed CONNECT is correctly included in them
            alvinr Alvin Richards (Inactive) added a comment - - edited

            These are the last two commits on 10.1, not clear if either of these fixes this issue. I search for MDEV-12520 in the git log and did not find anything.

            Author: Olivier Bertrand
            Date: Thu Mar 2 12:12:53 2017 +0100

            Update version number and date
            modified: storage/connect/ha_connect.cc

            Add conditional SE exception support
            modified: storage/connect/json.cpp
            modified: storage/connect/plgdbutl.cpp

            Change %p in %x in some sprintf functions.
            This to avoid some compiler warnings.
            modified: storage/connect/tabwmi.cpp
            modified: storage/connect/tabxml.cpp
            modified: storage/connect/value.h

            Author: Olivier Bertrand
            Date: Fri Feb 24 23:21:20 2017 +0100

            Fix crashing when joining two JDBC tables..
            Was in close (the virtual machine could have been detached.
            modified: storage/connect/jdbconn.cpp

            commit ac78927aefa2bd0d869d999839480d69086a9882
            Author: Igor Babaev <igor@askmonty.org>
            Date: Fri Feb 24 00:10:08 2017 -0800

            Fixed bug mdev-7992.

            'Not exists' optimization can be used for nested outer joins
            only if IS NULL predicate from the WHERE condition is activated.
            So we have to check that all guards that wrap this predicate

            alvinr Alvin Richards (Inactive) added a comment - - edited These are the last two commits on 10.1, not clear if either of these fixes this issue. I search for MDEV-12520 in the git log and did not find anything. Author: Olivier Bertrand Date: Thu Mar 2 12:12:53 2017 +0100 Update version number and date modified: storage/connect/ha_connect.cc Add conditional SE exception support modified: storage/connect/json.cpp modified: storage/connect/plgdbutl.cpp Change %p in %x in some sprintf functions. This to avoid some compiler warnings. modified: storage/connect/tabwmi.cpp modified: storage/connect/tabxml.cpp modified: storage/connect/value.h Author: Olivier Bertrand Date: Fri Feb 24 23:21:20 2017 +0100 Fix crashing when joining two JDBC tables.. Was in close (the virtual machine could have been detached. modified: storage/connect/jdbconn.cpp commit ac78927aefa2bd0d869d999839480d69086a9882 Author: Igor Babaev <igor@askmonty.org> Date: Fri Feb 24 00:10:08 2017 -0800 Fixed bug mdev-7992. 'Not exists' optimization can be used for nested outer joins only if IS NULL predicate from the WHERE condition is activated. So we have to check that all guards that wrap this predicate

            No these are not the fix I have done. Unfortunately, the 10.1 version released last week seem to have forgotten the recent changes to CONNECT.

            bertrandop Olivier Bertrand added a comment - No these are not the fix I have done. Unfortunately, the 10.1 version released last week seem to have forgotten the recent changes to CONNECT.

            What about the 10.2? I do not see 10.2.x in the fixed versions. may I assume we get this fix in 10.2.7 after some merge (from 10.1.25)?

            valerii Valerii Kravchuk added a comment - What about the 10.2? I do not see 10.2.x in the fixed versions. may I assume we get this fix in 10.2.7 after some merge (from 10.1.25)?

            I hope so. The fix was done end of april. Did you check it is not included in version 10.2.6?

            bertrandop Olivier Bertrand added a comment - I hope so. The fix was done end of april. Did you check it is not included in version 10.2.6?

            People

              bertrandop Olivier Bertrand
              wfong Will Fong
              Votes:
              1 Vote for this issue
              Watchers:
              4 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.