summaryrefslogtreecommitdiffstats
path: root/sql/item.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
commit86fbb58c3ac0865482819c10a3e81f2eea001c36 (patch)
tree28c9e526ea739c6f9b89e36115e1e2698bddf981 /sql/item.cc
parentReleasing progress-linux version 1:10.11.6-2~progress7.99u1. (diff)
downloadmariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.tar.xz
mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.zip
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc34
1 files changed, 28 insertions, 6 deletions
diff --git a/sql/item.cc b/sql/item.cc
index c6d51e47..6f9eb9d1 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2674,7 +2674,11 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
if (conv->fix_fields_if_needed(thd, arg))
return TRUE;
- if (!thd->stmt_arena->is_conventional())
+ if (!thd->stmt_arena->is_conventional() &&
+ ((!thd->lex->current_select &&
+ (thd->stmt_arena->is_stmt_prepare_or_first_sp_execute() ||
+ thd->stmt_arena->is_stmt_prepare_or_first_stmt_execute())) ||
+ thd->lex->current_select->first_cond_optimization))
{
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
@@ -2798,11 +2802,11 @@ Item_sp::func_name_cstring(THD *thd, bool is_package_function) const
quoted `pkg` and `func` separately, so the entire result looks like:
`db`.`pkg`.`func`
*/
- Database_qualified_name tmp= Database_qualified_name::split(m_name->m_name);
- DBUG_ASSERT(tmp.m_db.length);
- append_identifier(thd, &qname, &tmp.m_db);
+ Identifier_chain2 tmp= Identifier_chain2::split(m_name->m_name);
+ DBUG_ASSERT(tmp[0].length);
+ append_identifier(thd, &qname, &tmp[0]);
qname.append('.');
- append_identifier(thd, &qname, &tmp.m_name);
+ append_identifier(thd, &qname, &tmp[1]);
}
else
append_identifier(thd, &qname, &m_name->m_name);
@@ -7040,7 +7044,25 @@ Item *Item_float::neg(THD *thd)
else if (value < 0 && max_length)
max_length--;
value= -value;
- presentation= 0;
+ if (presentation)
+ {
+ if (*presentation == '-')
+ {
+ // Strip double minus: -(-1) -> '1' instead of '--1'
+ presentation++;
+ }
+ else
+ {
+ size_t presentation_length= strlen(presentation);
+ if (char *tmp= (char*) thd->alloc(presentation_length + 2))
+ {
+ tmp[0]= '-';
+ // Copy with the trailing '\0'
+ memcpy(tmp + 1, presentation, presentation_length + 1);
+ presentation= tmp;
+ }
+ }
+ }
name= null_clex_str;
return this;
}