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

Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
    • 10.2.11, 10.3.3
    • Prepared Statements
    • None

    Description

      DROP PROCEDURE IF EXISTS p1;
      DROP TABLE IF EXISTS t1;
      CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
      CALL p1(@a);
      PREPARE stmt FROM 'CALL p1(?)';
      EXECUTE stmt USING @b;
      DEALLOCATE PREPARE stmt;
      CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
      SHOW CREATE TABLE t1;
      

      +-------+----------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                     |
      +-------+----------------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `a` bigint(20) unsigned DEFAULT NULL,
        `b` bigint(20) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+----------------------------------------------------------------------------------------------------------------------------------+
      

      Notice, the column b is missing the unsigned flag.

      Attachments

        Activity

          The same problem is repeatable with the INT UNSIGNED data type:

          DROP PROCEDURE IF EXISTS p1;
          DROP TABLE IF EXISTS t1;
          CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
          CALL p1(@a);
          PREPARE stmt FROM 'CALL p1(?)';
          EXECUTE stmt USING @b;
          DEALLOCATE PREPARE stmt;
          CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
          SHOW CREATE TABLE t1;
          

          +-------+----------------------------------------------------------------------------------------------------------------------------------+
          | Table | Create Table                                                                                                                     |
          +-------+----------------------------------------------------------------------------------------------------------------------------------+
          | t1    | CREATE TABLE `t1` (
            `a` bigint(20) unsigned DEFAULT NULL,
            `b` bigint(20) DEFAULT NULL
          ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
          +-------+----------------------------------------------------------------------------------------------------------------------------------+
          

          bar Alexander Barkov added a comment - The same problem is repeatable with the INT UNSIGNED data type: DROP PROCEDURE IF EXISTS p1; DROP TABLE IF EXISTS t1; CREATE PROCEDURE p1( OUT v INT UNSIGNED) SET v = 2010; CALL p1(@a); PREPARE stmt FROM 'CALL p1(?)' ; EXECUTE stmt USING @b; DEALLOCATE PREPARE stmt; CREATE TABLE t1 AS SELECT @a AS a, @b AS b; SHOW CREATE TABLE t1; +-------+----------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+----------------------------------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL, `b` bigint(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +-------+----------------------------------------------------------------------------------------------------------------------------------+

          The same problem is repeatable with the BIT data type:

          DROP PROCEDURE IF EXISTS p1;
          DROP TABLE IF EXISTS t1;
          CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
          CALL p1(@a);
          PREPARE stmt FROM 'CALL p1(?)';
          EXECUTE stmt USING @b;
          DEALLOCATE PREPARE stmt;
          CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
          SHOW CREATE TABLE t1;
          

          +-------+----------------------------------------------------------------------------------------------------------------------------------+
          | Table | Create Table                                                                                                                     |
          +-------+----------------------------------------------------------------------------------------------------------------------------------+
          | t1    | CREATE TABLE `t1` (
            `a` bigint(20) unsigned DEFAULT NULL,
            `b` bigint(20) DEFAULT NULL
          ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
          +-------+----------------------------------------------------------------------------------------------------------------------------------+
          

          bar Alexander Barkov added a comment - The same problem is repeatable with the BIT data type: DROP PROCEDURE IF EXISTS p1; DROP TABLE IF EXISTS t1; CREATE PROCEDURE p1( OUT v BIT (16)) SET v = 2010; CALL p1(@a); PREPARE stmt FROM 'CALL p1(?)' ; EXECUTE stmt USING @b; DEALLOCATE PREPARE stmt; CREATE TABLE t1 AS SELECT @a AS a, @b AS b; SHOW CREATE TABLE t1; +-------+----------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+----------------------------------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL, `b` bigint(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +-------+----------------------------------------------------------------------------------------------------------------------------------+

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.