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

The function parameter's collation returns NULL when the collation is defined in the function

    XMLWordPrintable

Details

    Description

      10.4.31-dbg>SET @@local.character_set_connection='utf8mb4';
      Query OK, 0 rows affected (0.000 sec)
       
      10.4.31-dbg>
      10.4.31-dbg>DELIMITER ||
      10.4.31-dbg>CREATE FUNCTION f1(str TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin)
          -> RETURNS TEXT CHARACTER SET latin7 COLLATE latin7_bin
          -> BEGIN
          -> SET @param_coll = COLLATION(str);
          -> RETURN str;
          -> END ||
      Query OK, 0 rows affected (0.016 sec)
       
      10.4.31-dbg>DELIMITER ;
      10.4.31-dbg>
      10.4.31-dbg>SELECT COLLATION(f1('Hello, planet!'));
      +---------------------------------+
      | COLLATION(f1('Hello, planet!')) |
      +---------------------------------+
      | latin7_bin                      |
      +---------------------------------+
      1 row in set (0.001 sec)
       
      10.4.31-dbg>SELECT @param_coll;
      +-------------+
      | @param_coll |
      +-------------+
      | NULL        |
      +-------------+
      1 row in set (0.000 sec)
       
      10.4.31-dbg>
      

      Expected result

      10.4.31-dbg>SELECT @param_coll;
      +--------------------+
      | @param_coll        |
      +--------------------+
      | utf8mb4_bin        |
      +--------------------+
      1 row in set (0.000 sec)
       
      10.4.31-dbg>
      

      Attachments

        Activity

          People

            shulga Dmitry Shulga
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.