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

RECORD in routine parameters and function RETURN

    XMLWordPrintable

Details

    • Q1/2026 Server Development

    Description

      Currently the data types declared by the TYPE declarations (including RECORD) are not allowed in:

      • routine parameters
      • stored function RETURN clause

      This is prohibited by the grammar.

      We should allow TYPE types (using RECORD as an example) in these scenarios. It'll be needed for *TYPE .. IS REF CURSOR* for MDEV-10152. With REF CURSORs not allowed in parameters and RETURN the implementation of MDEV-10152 will be semi-baked.

      These scripts with RECORD demonstrate the problem:

      SET sql_mode=ORACLE;
      DELIMITER $$
      CREATE OR REPLACE PACKAGE pkg1 AS
        PROCEDURE p1();
      END;
      CREATE OR REPLACE PACKAGE BODY pkg1 AS
        TYPE rec0_t IS RECORD (a INT, b VARCHAR(2), c INT);
        PROCEDURE private_p1(p0 rec0_t) AS
        BEGIN
          NULL;
        END;
        PROCEDURE p1 AS
        BEGIN
          CALL private_p1(a0);
        END;
      END;
      $$
      DELIMITER ;
      

      ERROR 4161 (HY000): Unknown data type: 'rec0_t'
      

      SET sql_mode=ORACLE;
      DELIMITER $$
      CREATE OR REPLACE PACKAGE pkg1 AS
        PROCEDURE p1();
      END;
      CREATE OR REPLACE PACKAGE BODY pkg1 AS
        TYPE rec0_t IS RECORD (a INT, b VARCHAR(2), c INT);
        FUNCTION private_f1() RETURN rec0_t AS
        BEGIN
          RETURN NULL;
        END;
        PROCEDURE p1() AS
        BEGIN
          DO private_f1();
        END;
      END;
      $$
      DELIMITER ;
      

      ERROR 4161 (HY000): Unknown data type: 'rec0_t'
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              bar Alexander Barkov
              Alexander Barkov Alexander Barkov
              Oleksandr Byelkin Oleksandr Byelkin
              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.