summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-06-30 21:28:07 +0200
committerSergei Golubchik <serg@mariadb.org>2021-06-30 22:09:19 +0200
commitadd782a13e58c027c14d548fa705f48fc25cc3e1 (patch)
tree71559cdf443c28b1b911b860d6b1499c76098a42 /sql/table.cc
parentb62672af720560e40336c86fbe63151e1095f421 (diff)
downloadmariadb-git-add782a13e58c027c14d548fa705f48fc25cc3e1.tar.gz
fix JSON_ARRAYAGG not to over-quote json in joins
This replaces 8711adb7863 if a temptable field is created for some json expression (is_json_type() returns true), make this temptable field a proper json field. A field is a json field (see Item_field::is_json_type()) if it has a CHECK constraint of JSON_VALID(field). Note that it will never be actually checked for temptable fields, so it won't cause a run-time slowdown.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/sql/table.cc b/sql/table.cc
index c9420892160..73d701e0b2b 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -61,6 +61,17 @@ public:
}
};
+bool TABLE::init_expr_arena(MEM_ROOT *mem_root)
+{
+ /*
+ We need to use CONVENTIONAL_EXECUTION here to ensure that
+ any new items created by fix_fields() are not reverted.
+ */
+ expr_arena= new (alloc_root(mem_root, sizeof(Table_arena)))
+ Table_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION);
+ return expr_arena == NULL;
+}
+
struct extra2_fields
{
LEX_CUSTRING version;
@@ -1155,14 +1166,8 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
table->s->table_check_constraints * sizeof(Virtual_column_info*));
DBUG_ASSERT(table->expr_arena == NULL);
- /*
- We need to use CONVENTIONAL_EXECUTION here to ensure that
- any new items created by fix_fields() are not reverted.
- */
- table->expr_arena= new (alloc_root(mem_root, sizeof(Table_arena)))
- Table_arena(mem_root,
- Query_arena::STMT_CONVENTIONAL_EXECUTION);
- if (!table->expr_arena)
+
+ if (table->init_expr_arena(mem_root))
DBUG_RETURN(1);
thd->set_n_backup_active_arena(table->expr_arena, &backup_arena);