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

Parameterized UPDATE/DELETE/Stored routines against ENGINE=DuckDB fails

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      Parameterized UPDATE/DELETE/stored routines against ENGINE=DuckDB fails. Improve error handling for parameterized operations against ENGINE=DuckDB by returning a clear and appropriate error message.

      Test case

      INSTALL SONAME 'ha_duckdb';
      CREATE OR REPLACE TABLE t1 (id INT PRIMARY KEY, val INT) ENGINE=DuckDB;
      INSERT INTO t1 VALUES (1,10),(2,20),(3,30);
       
      SET @v = 99;
      UPDATE t1 SET val=@v WHERE id=1;
      SET @k = 2;
      DELETE FROM t1 WHERE id=@k;
      SELECT * FROM t1 WHERE id=@k;
       
      PREPARE s FROM 'UPDATE t1 SET val=? WHERE id=?';
      SET @a = 100, @b = 3;
      EXECUTE s USING @a, @b;
      

      CLI Output

      13.1.0-opt>INSTALL SONAME 'ha_duckdb';
      Query OK, 0 rows affected (0.086 sec)
       
      13.1.0-opt>CREATE OR REPLACE TABLE t1 (id INT PRIMARY KEY, val INT) ENGINE=DuckDB;
      Query OK, 0 rows affected (0.014 sec)
       
      13.1.0-opt>INSERT INTO t1 VALUES (1,10),(2,20),(3,30);
      Query OK, 3 rows affected (0.020 sec)
      Records: 3  Duplicates: 0  Warnings: 0
       
      13.1.0-opt>
      13.1.0-opt>SET @v = 99;
      Query OK, 0 rows affected (0.000 sec)
       
      13.1.0-opt>UPDATE t1 SET val=@v WHERE id=1;
      ERROR 1296 (HY000): Got error 168 'Parser Error: syntax error at or near "=@"
       
      LINE 1: UPDATE t1 SET val=@v WHERE id=1
                               ^' from DuckDB
      13.1.0-opt>SET @k = 2;
      Query OK, 0 rows affected (0.000 sec)
       
      13.1.0-opt>DELETE FROM t1 WHERE id=@k;
      ERROR 1296 (HY000): Got error 168 'Catalog Error: Scalar Function with name =@ does not exist!
      Did you mean "<@"?
       
      LINE 1: DELETE FROM t1 WHERE id=@k
                                     ^' from DuckDB
      13.1.0-opt>SELECT * FROM t1 WHERE id=@k;
      ERROR 1031 (HY000): Storage engine DUCKDB of the table `test`.`t1` doesn't have this option
      13.1.0-opt>
      13.1.0-opt>PREPARE s FROM 'UPDATE t1 SET val=? WHERE id=?';
      Query OK, 0 rows affected (0.000 sec)
      Statement prepared
       
      13.1.0-opt>SET @a = 100, @b = 3;
      Query OK, 0 rows affected (0.000 sec)
       
      13.1.0-opt>EXECUTE s USING @a, @b;
      ERROR 1296 (HY000): Got error 168 'Invalid Input Error: Expected 2 parameters, but none were supplied' from DuckDB
      13.1.0-opt>
      

      Attachments

        Issue Links

          Activity

            People

              drrtuy Roman
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

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