summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2022-08-05 17:57:27 +0300
committerMonty <monty@mariadb.org>2022-08-08 11:19:55 +0300
commita5a9fcdfe44ffb093887a255254d128fe3752fd1 (patch)
tree98be8b5feb50765aa8c802f80edf824c1b9ba2ca /sql/sql_class.h
parent43c7f6a0f3d2d636fea0decfc9b5818e4a7c885a (diff)
downloadmariadb-git-a5a9fcdfe44ffb093887a255254d128fe3752fd1.tar.gz
MDEV-12325 Unexpected data type and truncation when using CTE
When creating a recursive CTE, the column types are taken from the non recursive part of the CTE (this is according to the SQL standard). This patch adds code to abort the CTE if the calculated values in the recursive part does not fit in the fields in the created temporary table. The new code only affects recursive CTE, so it should not cause any notable problems for old applications. Other things: - Fixed that we get correct row numbers for warnings generated with WITH RECURSIVE Reviewer: Alexander Barkov <bar@mariadb.com>
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 850a8364adc..05b8f7eb443 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -5691,10 +5691,12 @@ class select_union_recursive :public select_unit
or for the unit specifying a CTE that mutually recursive with this CTE.
*/
uint cleanup_count;
+ long row_counter;
select_union_recursive(THD *thd_arg):
select_unit(thd_arg),
- incr_table(0), first_rec_table_to_update(0), cleanup_count(0)
+ incr_table(0), first_rec_table_to_update(0), cleanup_count(0),
+ row_counter(0)
{ incr_table_param.init(); };
int send_data(List<Item> &items);