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

ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table

    XMLWordPrintable

    Details

      Description

      ERROR_INDEX upon INSERT here behaves similarly to the one on Federated table in MDEV-26654; however UPDATE shows a difference – it seems all right with Federated, but wrong with Spider. I've grouped the failures by engine for now, but it's possible that INSERT problem is the same for Federated and Spider, while UPDATE problem on Spider is different. Please feel free to rearrange the reports as you deem fit.

      install soname 'ha_spider';
      set spider_same_server_link=1;
       
      CREATE OR REPLACE TABLE t (id INT PRIMARY KEY);
      eval CREATE OR REPLACE TABLE spd (id INT PRIMARY KEY) ENGINE=SPIDER COMMENT 'host "127.0.0.1", user "root", password "", port "$MASTER_MYPORT", table "t"';
       
      --error ER_DUP_ENTRY
      INSERT INTO spd VALUES (1),(2),(1);
      GET DIAGNOSTICS CONDITION 1 @n = ERROR_INDEX;
      SELECT @n;
       
      DELETE FROM t;
      INSERT INTO spd VALUES (1),(2),(3),(13);
      --error ER_DUP_ENTRY
      UPDATE spd SET id = id + 10;
      GET DIAGNOSTICS CONDITION 1 @n = ERROR_INDEX;
      SELECT @n;
      

      Result, 10.7 d552e092

      INSERT INTO spd VALUES (1),(2),(1);
      ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
      GET DIAGNOSTICS CONDITION 1 @n = ERROR_INDEX, @msg = MESSAGE_TEXT;
      SELECT @n, @msg;
      @n	@msg
      4	Duplicate entry '1' for key 'PRIMARY'
      DELETE FROM t;
      INSERT INTO spd VALUES (1),(2),(3),(13);
      UPDATE spd SET id = id + 10;
      ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
      GET DIAGNOSTICS CONDITION 1 @n = ERROR_INDEX, @msg = MESSAGE_TEXT;
      SELECT @n, @msg;
      @n	@msg
      1	Duplicate entry '13' for key 'PRIMARY'
      

      In the test case above, ERROR_INDEX after the failed INSERT is 4, while the expected value is 3. So, it is off by one, as with Federated in MDEV-26654.

      Upon UPDATE, the ERROR_INDEX is 1, while the expected value is 3. So, it's probably not set at all.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration