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

Warning message info is not showing in the result set when SQL_MODE is set to ORACLE in a procedure

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.8
    • 11.8
    • PL/SQL
    • None

    Description

      Warning message info is not showing in the result set when SQL_MODE is set to ORACLE in a procedure
      Test case

      SET SQL_MODE=ORACLE;
      CREATE OR REPLACE TABLE t1( c VARCHAR(2));
       
      DELIMITER $$
       
      CREATE OR REPLACE PROCEDURE p1 AS
        TYPE RecT IS RECORD (
          c_name  t1.c%TYPE
        );
        rec RecT:= RecT('aaa');
       
       
      BEGIN
        INSERT INTO t1 SELECT rec.c_name;
      END;
      $$
      DELIMITER ;
      CALL p1;
      INSERT INTO t1 SELECT 'xyz';
      SHOW WARNINGS;
      SELECT * FROM t1;
      

      Output

      11.7.0-dbg>SET SQL_MODE=ORACLE;
      Query OK, 0 rows affected (0.001 sec)
       
      11.7.0-dbg>CREATE OR REPLACE TABLE t1( c VARCHAR(2));
      Query OK, 0 rows affected (0.070 sec)
       
      11.7.0-dbg>
      11.7.0-dbg>DELIMITER $$
      11.7.0-dbg>
      11.7.0-dbg>CREATE OR REPLACE PROCEDURE p1 AS
          ->   TYPE RecT IS RECORD (
          ->     c_name  t1.c%TYPE
          ->   );
          ->   rec RecT:= RecT('aaa');
          -> 
          -> 
          -> BEGIN
          ->   INSERT INTO t1 SELECT rec.c_name;
          -> END;
          -> $$
      Query OK, 0 rows affected (0.037 sec)
       
      11.7.0-dbg>DELIMITER ;
      11.7.0-dbg>CALL p1;
      Query OK, 1 row affected (0.004 sec)
       
      11.7.0-dbg>INSERT INTO t1 SELECT 'xyz';
      Query OK, 1 row affected, 1 warning (0.003 sec)
      Records: 1  Duplicates: 0  Warnings: 1
       
      11.7.0-dbg>SHOW WARNINGS;
      +---------+------+----------------------------------------+
      | Level   | Code | Message                                |
      +---------+------+----------------------------------------+
      | Warning | 1265 | Data truncated for column 'c' at row 1 |
      +---------+------+----------------------------------------+
      1 row in set (0.000 sec)
       
      11.7.0-dbg>SELECT * FROM t1;
      +------+
      | c    |
      +------+
      | aa   |
      | xy   |
      +------+
      2 rows in set (0.000 sec)
       
      11.7.0-dbg>
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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