Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(trunk) PS-9155: Crash in row_sel_convert_mysql_key_to_innobase #5284

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mysql-test/r/derived.result
Original file line number Diff line number Diff line change
Expand Up @@ -2304,7 +2304,7 @@ explain SELECT *
FROM t1 JOIN (SELECT * FROM t2 UNION SELECT * FROM t2) AS dt ON t1.a=dt.a;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY <derived2> NULL ref <auto_key1> <auto_key1> 5 test.t1.a 2 100.00 NULL
1 PRIMARY <derived2> NULL ref <auto_key0> <auto_key0> 5 test.t1.a 2 100.00 NULL
2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 NULL
3 UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 NULL
4 UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Using temporary
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/r/derived_condition_pushdown.result
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ EXPLAIN
-> Nested loop inner join (rows=8)
-> Filter: ((t1.f2 > 40) and (t1.f2 is not null)) (rows=4)
-> Table scan on t1 (rows=12)
-> Index lookup on dt using <auto_key1> (f2=t1.f2) (rows=2)
-> Index lookup on dt using <auto_key0> (f2=t1.f2) (rows=2)
-> Union materialize with deduplication (rows=2)
-> Filter: (t1.f1 > 31) (rows=1)
-> Covering index range scan on t1 using f1_2 over (31 < f1) (rows=1)
Expand Down Expand Up @@ -1996,7 +1996,7 @@ EXPLAIN
-> Nested loop inner join (rows=104)
-> Filter: (t2.f2 is not null) (rows=13)
-> Table scan on t2 (rows=13)
-> Index lookup on v using <auto_key1> (f2=t2.f2) (rows=2)
-> Index lookup on v using <auto_key0> (f2=t2.f2) (rows=2)
-> Union materialize with deduplication (rows=8)
-> Filter: (t1.f2 > 10) (rows=4)
-> Table scan on t1 (rows=12)
Expand Down Expand Up @@ -2025,7 +2025,7 @@ EXPLAIN
-> Nested loop inner join (rows=104)
-> Filter: (t2.f2 is not null) (rows=13)
-> Table scan on t2 (rows=13)
-> Index lookup on v using <auto_key1> (f2=t2.f2) (rows=2)
-> Index lookup on v using <auto_key0> (f2=t2.f2) (rows=2)
-> Union materialize with deduplication (rows=8)
-> Filter: (t1.f2 > 10) (rows=4)
-> Table scan on t1 (rows=12)
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/view.result
Original file line number Diff line number Diff line change
Expand Up @@ -4465,7 +4465,7 @@ explain SELECT *
FROM t1 JOIN vu_1 AS dt ON t1.a=dt.a;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # # Using where
1 PRIMARY <derived2> NULL ref <auto_key1> <auto_key1> 5 test.t1.a # # NULL
1 PRIMARY <derived2> NULL ref <auto_key0> <auto_key0> 5 test.t1.a # # NULL
2 DERIVED t2 NULL ALL NULL NULL NULL NULL # # NULL
3 UNION t2 NULL ALL NULL NULL NULL NULL # # NULL
4 UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL # # Using temporary
Expand Down
2 changes: 1 addition & 1 deletion sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6059,7 +6059,7 @@ bool TABLE::add_tmp_key(Field_map *key_parts, bool invisible,
s->max_key_length = std::max(s->max_key_length, key_len);
s->key_parts += key_part_count;
assert(s->keys < s->max_tmp_keys);
sprintf(s->key_names[s->keys].name, "<auto_key%d>", s->keys);
sprintf(s->key_names[s->keys].name, "<auto_key%d>", s->temp_table_key_id++);
s->keys++;
}

Expand Down
1 change: 1 addition & 0 deletions sql/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ struct TABLE_SHARE {
uint fields{0}; /* Number of fields */
uint rec_buff_length{0}; /* Size of table->record[] buffer */
uint keys{0}; /* Number of keys defined for the table*/
uint temp_table_key_id{0}; /* Serves the unique number for <auto_keyN> */
uint key_parts{0}; /* Number of key parts of all keys
defined for the table
*/
Expand Down
Loading