Details

    Description

      The task MDEV-10914 implements the ROW data type for stored routine local variables and parameters.

      This task will additionally allow to use ROW in stored function return data type.

      DROP FUNCTION IF EXISTS f1;
      DELIMITER $$
      CREATE FUNCTION f1(a INT, b VARCHAR(32)) RETURNS ROW(a INT, b VARCHAR(32))
      BEGIN
        RETURN ROW(a,b);
      END;
      $$
      DELIMITER ;
      SELECT f1(1,'b1') = ROW(1,'b1');
      

      Anchored row data types should also be supported:

      DROP FUNCTION IF EXISTS f1;
      DELIMITER $$
      CREATE FUNCTION f1(a INT, b VARCHAR(32)) RETURNS ROW TYPE OF t1
      BEGIN
        RETURN ROW(a,b);
      END;
      $$
      DELIMITER ;
      SELECT f1(1,'b1') = ROW(1,'b1');
      

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov added a comment - Hi serg , Can you please review: https://github.com/MariaDB/server/commit/388b72578cdee7afbd0403e94077ee90ed648008 ? Thanks.
            bradlanier Brad Lanier added a comment - - edited

            Actually, the key word TYPE OF should be allowed in a function return for ALL data types, including ROW. The strength of TYPE OF is in Stored Routine maintenance. When a function returns a value that is directly used in a SQL table query, that value should be allowed to be TYPED in relation to the field that it is to be used with.

            Therefore, I strongly urge the DEVO, when implementing ROW for function returns, to go a little bit further and implement TYPE OF for ROW as well as ALL OTHER data types.

            bradlanier Brad Lanier added a comment - - edited Actually, the key word TYPE OF should be allowed in a function return for ALL data types, including ROW. The strength of TYPE OF is in Stored Routine maintenance. When a function returns a value that is directly used in a SQL table query, that value should be allowed to be TYPED in relation to the field that it is to be used with. Therefore, I strongly urge the DEVO, when implementing ROW for function returns, to go a little bit further and implement TYPE OF for ROW as well as ALL OTHER data types.

            serg,

            Please see a new patch version here:

            https://github.com/MariaDB/server/commit/c46e7c5cb64940c8929a6d8e09a308cb690b5fdc

            Rebased to the latest codebase.

            bar Alexander Barkov added a comment - serg , Please see a new patch version here: https://github.com/MariaDB/server/commit/c46e7c5cb64940c8929a6d8e09a308cb690b5fdc Rebased to the latest codebase.
            bar Alexander Barkov added a comment - - edited

            bradlanier, this patch extends the RETURNS clause to support both:

            • explicit ROW
            • anchored data types (TYPE OF and ROW TYPE OF) - MDEV-11210

            We should rephrase the task description slightly.

            bar Alexander Barkov added a comment - - edited bradlanier , this patch extends the RETURNS clause to support both: explicit ROW anchored data types (TYPE OF and ROW TYPE OF) - MDEV-11210 We should rephrase the task description slightly.
            bar Alexander Barkov added a comment - Hello Sergei, Please find a new patch version here: https://github.com/MariaDB/server/commit/715dbfa6757d319b1a18004467ed0b5b26fc31a3

            715dbfa6757 is ok to push

            serg Sergei Golubchik added a comment - 715dbfa6757 is ok to push
            bar Alexander Barkov added a comment - Hello elenst , Please find the patch for testing in this branch: https://github.com/MariaDB/server/tree/bb-11.7-bar-MDEV-12252-sp-row This is the patch itself: https://github.com/MariaDB/server/commit/cb8496d989a5db6356ddb188aa30d008161284ba Thanks

            okay to push

            ramesh Ramesh Sivaraman added a comment - okay to push

            People

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