Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-1570

Wrong data when inserting NULL into DECIMAL column with non-default precision

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Duplicate
    • 1.1.5
    • Icebox
    • None
    • None
    • Linux CentOS 7.5

    Description

      When creating a table with DECIMAL columns and a specific precision, then using mcsapi to insert NULL will end up with incorrect data. Create to following table:

      CREATE TABLE `t1` (
        `c1` decimal(10,0) DEFAULT NULL,
        `c2` decimal(9,0) DEFAULT NULL,
        `c3` decimal(16,0) DEFAULT NULL
      ) ENGINE=Columnstore
      

      Compile and run this program, which should insert INTO into all columns in the table above:

      #include <libmcsapi/mcsapi.h>
      #include <iostream>
       
      int main(int argc, char *argv[])
         {
         mcsapi::ColumnStoreDriver* driver = nullptr;
         mcsapi::ColumnStoreBulkInsert* bulk = nullptr;
       
         try {
            driver = new mcsapi::ColumnStoreDriver();
            bulk = driver->createBulkInsert("test", "t1", 0, 0);
            bulk->setNull(0);
            bulk->setNull(1);
            bulk->setNull(2);
            bulk->writeRow();
            bulk->commit();
         } catch (mcsapi::ColumnStoreError &e) {
            std::cout << "Error caught: " << e.what() << std::endl;
         }
         delete bulk;
         delete driver;
       
         return 0;
         }
      

      MariaDB [test]> select * from t1;
      +------+------+---------+
      | c1   | c2   | c3      |
      +------+------+---------+
      | NULL | 0    | 8388608 |
      +------+------+---------+
      1 row in set (0.11 sec)
      

      Attachments

        Issue Links

          Activity

            People

              LinuxJedi Andrew Hutchings (Inactive)
              karlsson Anders Karlsson
              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.