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

Virtual column value depends on the user who first opens the table

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0, 10.1, 10.2
    • 10.2.3
    • Virtual Columns
    • None

    Description

      This script:

      SET NAMES utf8;
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (COALESCE('a'='A',a)) VIRTUAL); 
      SHOW CREATE TABLE t1;
      INSERT INTO t1 (a) VALUES (0);
      SELECT * FROM t1;
      

      returns

      +------+------+
      | a    | b    |
      +------+------+
      |    0 |    1 |
      +------+------+
      

      Now I flush and reopen the table with a binary session collation:

      FLUSH TABLES;
      SET NAMES utf8 COLLATE utf8_bin;
      SELECT * FROM t1;
      

      It returns:

      +------+------+
      | a    | b    |
      +------+------+
      |    0 |    0 |
      +------+------+
      

      Now I exit the client and start a new session:

      SET NAMES utf8;
      SELECT * FROM t1;
      

      It returns:

      +------+------+
      | a    | b    |
      +------+------+
      |    0 |    0 |
      +------+------+
      

      These results looks wrong. The result of comparison of 'a'='A' depends on the @@collation_connection of the session which opened the table.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.