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

COLLATE keyword doesn't work in PREPARE query

    XMLWordPrintable

Details

    Description

      COLLATE keyword doesn't work in PREPARE query.
      Example :

      CREATE TABLE IF NOT EXISTS `tt` (
          `test` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
       
      SELECT * FROM `tt` WHERE `test` LIKE  'jj' COLLATE utf8mb4_unicode_ci 
      

      Text work well

      	PREPARE stmt FROM 'SELECT * FROM `tt` WHERE `test` LIKE  ? COLLATE utf8mb4_unicode_ci'
      

      will throw an error

      Erreur SQL (1253) : COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'binary'"
      

      In PREPARE, collate is always considering character set as binary.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              diego dupin Diego Dupin
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.