summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2021-02-26 20:38:20 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2021-03-12 10:13:05 +0530
commit390de205ccbc0dc9b3e0dc81ad36d6686c3c06a5 (patch)
tree382940170b56b413e33ca363ab676ff302a10162 /sql/item_subselect.h
parent1f3f90318f6431551472d239ee01cec5f80074d9 (diff)
downloadmariadb-git-390de205ccbc0dc9b3e0dc81ad36d6686c3c06a5.tar.gz
MDEV-24519: Server crashes in Charset::set_charset upon SELECT
The query causing the issue here has implicit grouping for we have to produce one row with special values for the aggregates (depending on each aggregate function), and NULL values for all non-aggregate fields. The subselect item where implicit grouping was being done, null_value for the subselect item was not being set for the case when the implicit grouping produces NULL values for the items in the select list of the subquery. This which was leading to the crash. The fix would be to set the null_value when all the values for the row column have NULL values. Further changes are 1) etting null_value for Item_singlerow_subselect only after val_* functions have been called. 2) Introduced a parameter null_value_inside to Item_cache that would store be set to TRUE if any of the arguments of the Item_cache are null. Reviewed And co-authored by Monty
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 9116238c640..130f90839e3 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -48,7 +48,11 @@ class Cached_item;
class Item_subselect :public Item_result_field,
protected Used_tables_and_const_cache
{
- bool value_assigned; /* value already assigned to subselect */
+ /*
+ Set to TRUE if the value is assigned for the subselect
+ FALSE: subquery not executed or the subquery returns an empty result
+ */
+ bool value_assigned;
bool own_engine; /* the engine was not taken from other Item_subselect */
protected:
/* thread handler, will be assigned in fix_fields only */