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

ER_OPEN_AS_READONLY or assertion failure upon multi-UPDATE on view with subquery

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.1.2, 11.2(EOL), 11.4, 11.6(EOL)
    • 11.4
    • Locking, Views
    • None

    Description

      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(2);
      CREATE TABLE t2 (b INT);
      INSERT INTO t2 VALUES (1),(2);
      CREATE VIEW v AS SELECT a FROM (SELECT a FROM t1) AS sq;
      --error ER_NON_UPDATABLE_TABLE
      UPDATE v, t2 SET v.a = 3;
       
      # Cleanup
      DROP VIEW v;
      DROP TABLE t1, t2;
      

      Before 11.1, the UPDATE was causing ER_NON_UPDATABLE_TABLE (note the subquery in the view definition). Since 11.1, it apparently attempts to be executed but also fails, on non-debug builds with the error:

      11.2 ebefef658ebff14d55ebb068a0e4af3a6b647d44

      mysqltest: At line 7: query 'UPDATE v, t2 SET v.a = 3' failed with wrong errno ER_OPEN_AS_READONLY (1036): 'Table './test/t1.MYI' is read only'
      

      and on debug builds with an assertion failure:

      11.2 ebefef658ebff14d55ebb068a0e4af3a6b647d44

      mariadbd: /data/bld/11.2-asan/sql/handler.cc:7980: int handler::ha_update_row(const uchar*, const uchar*): Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed.
      241023 19:58:28 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f6ba5453e32 in __GI___assert_fail (assertion=0x557c67273b00 "table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1", file=0x557c6726d9c0 "/data/bld/11.2-asan/sql/handler.cc", line=7980, function=0x557c67276ec0 "int handler::ha_update_row(const uchar*, const uchar*)") at ./assert/assert.c:101
      #10 0x0000557c653d2cf4 in handler::ha_update_row (this=0x61d0002206b8, old_data=0x61900009a1d0 "\375\001", new_data=0x61900009a1c8 "\375\003") at /data/bld/11.2-asan/sql/handler.cc:7980
      #11 0x0000557c64de1524 in multi_update::send_data (this=0x629000265f80, not_used_values=...) at /data/bld/11.2-asan/sql/sql_update.cc:2348
      #12 0x0000557c64c36eeb in select_result_sink::send_data_with_check (this=0x629000265f80, items=..., u=0x62c0000c4770, sent=0) at /data/bld/11.2-asan/sql/sql_class.h:5956
      #13 0x0000557c64becbdf in end_send (join=0x629000267238, join_tab=0x62900026a720, end_of_records=false) at /data/bld/11.2-asan/sql/sql_select.cc:25357
      #14 0x0000557c64be49c9 in evaluate_join_record (join=0x629000267238, join_tab=0x62900026a2b0, error=0) at /data/bld/11.2-asan/sql/sql_select.cc:24283
      #15 0x0000557c64be3245 in sub_select (join=0x629000267238, join_tab=0x62900026a2b0, end_of_records=false) at /data/bld/11.2-asan/sql/sql_select.cc:24050
      #16 0x0000557c64be49c9 in evaluate_join_record (join=0x629000267238, join_tab=0x629000269e40, error=0) at /data/bld/11.2-asan/sql/sql_select.cc:24283
      #17 0x0000557c64be3245 in sub_select (join=0x629000267238, join_tab=0x629000269e40, end_of_records=false) at /data/bld/11.2-asan/sql/sql_select.cc:24050
      #18 0x0000557c64be0ad1 in do_select (join=0x629000267238, procedure=0x0) at /data/bld/11.2-asan/sql/sql_select.cc:23561
      #19 0x0000557c64b5cc51 in JOIN::exec_inner (this=0x629000267238) at /data/bld/11.2-asan/sql/sql_select.cc:5043
      #20 0x0000557c64b59fb4 in JOIN::exec (this=0x629000267238) at /data/bld/11.2-asan/sql/sql_select.cc:4820
      #21 0x0000557c64c2b9ee in Sql_cmd_dml::execute_inner (this=0x6290000e7420, thd=0x62c0000c0218) at /data/bld/11.2-asan/sql/sql_select.cc:34329
      #22 0x0000557c64de9515 in Sql_cmd_update::execute_inner (this=0x6290000e7420, thd=0x62c0000c0218) at /data/bld/11.2-asan/sql/sql_update.cc:3106
      #23 0x0000557c64c2b4da in Sql_cmd_dml::execute (this=0x6290000e7420, thd=0x62c0000c0218) at /data/bld/11.2-asan/sql/sql_select.cc:34266
      #24 0x0000557c64a4491d in mysql_execute_command (thd=0x62c0000c0218, is_called_from_prepared_stmt=false) at /data/bld/11.2-asan/sql/sql_parse.cc:4433
      #25 0x0000557c64a5c422 in mysql_parse (thd=0x62c0000c0218, rawbuf=0x6290000e6238 "UPDATE v, t2 SET v.a = 3", length=24, parser_state=0x7f6b9ad2ea30) at /data/bld/11.2-asan/sql/sql_parse.cc:7938
      #26 0x0000557c64a34024 in dispatch_command (command=COM_QUERY, thd=0x62c0000c0218, packet=0x629000249219 "UPDATE v, t2 SET v.a = 3", packet_length=24, blocking=true) at /data/bld/11.2-asan/sql/sql_parse.cc:1894
      #27 0x0000557c64a30d61 in do_command (thd=0x62c0000c0218, blocking=true) at /data/bld/11.2-asan/sql/sql_parse.cc:1407
      #28 0x0000557c64f0bfe4 in do_handle_one_connection (connect=0x608000003638, put_in_cache=true) at /data/bld/11.2-asan/sql/sql_connect.cc:1439
      #29 0x0000557c64f0b9a0 in handle_one_connection (arg=0x6080000035b8) at /data/bld/11.2-asan/sql/sql_connect.cc:1341
      #30 0x0000557c65b6d944 in pfs_spawn_thread (arg=0x617000005b98) at /data/bld/11.2-asan/storage/perfschema/pfs.cc:2201
      #31 0x00007f6ba54a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #32 0x00007f6ba552861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            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.