diff options
author | Monty <monty@mariadb.org> | 2021-02-27 19:56:46 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2021-03-01 22:09:05 +0200 |
commit | 6983ce704baff7a6e5dd411a289e3580bc7bea1a (patch) | |
tree | 565c9fd66978b9f0eeaca90a2c9bdde6dd60d4ef /sql/table.h | |
parent | 43a0a8139727314f89fc0f0f0d2ba80ffa33b221 (diff) | |
download | mariadb-git-6983ce704baff7a6e5dd411a289e3580bc7bea1a.tar.gz |
MDEV-24710 Uninitialized value upon CREATE .. SELECT ... VALUE...
The failure happened for group by queries when all tables where marked as
'const tables' (tables with 0-1 matching rows) and no row matched the
where clause and there was in addition a direct reference to a field.
In this case the field would not be properly reset and the query would
return 'random data' that happended to be in table->record[0].
Fixed by marking all const tables as null tables in this particular case.
Sergei also provided an extra test case for the code.
@reviewer Sergei Petrunia <psergey@askmonty.org>
Diffstat (limited to 'sql/table.h')
-rw-r--r-- | sql/table.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/table.h b/sql/table.h index 3c31a6364df..6a4c6eb2a03 100644 --- a/sql/table.h +++ b/sql/table.h @@ -3145,6 +3145,12 @@ inline void mark_as_null_row(TABLE *table) bfill(table->null_flags,table->s->null_bytes,255); } +inline void unmark_as_null_row(TABLE *table) +{ + table->null_row=0; + table->status= STATUS_NO_RECORD; +} + bool is_simple_order(ORDER *order); class Open_tables_backup; |