Skip to content

Commit 271b737

Browse files
committed
MDEV-30263 Assertion failure in Protocol::end_statement upon HANDLER READ with invalid timestamp
Process save_in_field() return codes as in other places (<0 is real error)
1 parent d1f42fc commit 271b737

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# MDEV-30263: --echo # Assertion failure in Protocol::end_statement
3+
# upon HANDLER READ with invalid timestamp
4+
#
5+
CREATE TABLE t (a TIMESTAMP, KEY(a));
6+
HANDLER t OPEN;
7+
HANDLER t READ a > ('2022-12');
8+
a
9+
# above should issue the same warnings/errors as following
10+
SELECT * from t WHERE t.a > ('2022-12');
11+
a
12+
HANDLER t CLOSE;
13+
DROP TABLE t;
14+
End of 10.5 tests
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--echo #
2+
--echo # MDEV-30263: --echo # Assertion failure in Protocol::end_statement
3+
--echo # upon HANDLER READ with invalid timestamp
4+
--echo #
5+
6+
CREATE TABLE t (a TIMESTAMP, KEY(a));
7+
HANDLER t OPEN;
8+
HANDLER t READ a > ('2022-12');
9+
--echo # above should issue the same warnings/errors as following
10+
SELECT * from t WHERE t.a > ('2022-12');
11+
# Cleanup
12+
HANDLER t CLOSE;
13+
DROP TABLE t;
14+
15+
--echo End of 10.5 tests

sql/sql_handler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler,
700700
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
701701
int res= item->save_in_field(key_part->field, 1);
702702
dbug_tmp_restore_column_map(&table->write_set, old_map);
703-
if (res)
703+
if (res < 0 || thd->is_error())
704704
return 1;
705705
}
706706
key_len+= key_part->store_length;

0 commit comments

Comments
 (0)