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

Simultaneous assignment for INSERT ... SET

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT 20, c INT);
      INSERT INTO t1 SET c=a;
      SELECT * FROM t1;
      

      +------+------+------+
      | a    | b    | c    |
      +------+------+------+
      |   10 |   20 |   10 |
      +------+------+------+
      

      Notice, c was assigned to 10, which is the default value for a.

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT 20, c INT);
      INSERT INTO t1 SET a=11,c=a;
      SELECT * FROM t1;
      

      +------+------+------+
      | a    | b    | c    |
      +------+------+------+
      |   11 |   20 |   11 |
      +------+------+------+
      

      Notice, c was assigned to 11, which is the new value of a, after a=11 was done.

      We're assing a new sql_mode soon, for simultaneous assignments (See MDEV-13417).
      this query should probably also follow the new sql_mode, so c is to the initial (default) value of a, which is 10.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bar Alexander Barkov
              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.