summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-04-15 13:15:36 +0300
committerSergei Petrunia <psergey@askmonty.org>2021-04-15 13:15:36 +0300
commitb0824e63f9ad99773d493af55a453e5cd9e976eb (patch)
tree55f10beef45ba1105e59169aaf6529c8eed495a2
parent4b4abd8d146fba5d5fff9c29b811d30bbc4aeb13 (diff)
downloadmariadb-git-bb-10.6-monty-mdev17399.tar.gz
JSON_TABLE: post-rebase fixesbb-10.6-monty-mdev17399
-rw-r--r--mysql-test/suite/json/r/json_table.result2
-rw-r--r--mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result4
-rw-r--r--sql/ha_partition.cc7
-rw-r--r--sql/json_table.cc35
-rw-r--r--sql/share/errmsg-utf8.txt8
-rw-r--r--sql/sql_explain.cc2
-rw-r--r--sql/sql_yacc.yy2
7 files changed, 38 insertions, 22 deletions
diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result
index 34f25f316d4..a98efa70b48 100644
--- a/mysql-test/suite/json/r/json_table.result
+++ b/mysql-test/suite/json/r/json_table.result
@@ -583,7 +583,7 @@ select a from json_table('[[]]', '$' columns(a char(8) path '$' error on error))
ERROR HY000: Can't store an array or an object in the scalar column 'a' of JSON_TABLE 't'.
show warnings;
Level Code Message
-Error 4177 Can't store an array or an object in the scalar column 'a' of JSON_TABLE 't'.
+Error 4182 Can't store an array or an object in the scalar column 'a' of JSON_TABLE 't'.
#
# MDEV-JSON_TABLE: CREATE TABLE ignores NULL ON ERROR (implicit or explicit) and fails.
#
diff --git a/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result b/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
index 9ab986a1314..91ae3cb40e1 100644
--- a/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
+++ b/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
@@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
####################################
SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
event_name digest digest_text sql_text
-statement/sql/select 36b60eb4c0a269b4d8e3c2037f5c6c36 SELECT ? + ? + SELECT ...
-statement/sql/truncate eddd22a5c210f96a5160acbb5d7563b3 TRUNCATE TABLE truncat...
+statement/sql/select cf4e66f3ef1e0c9905538c220053cbda SELECT ? + ? + SELECT ...
+statement/sql/truncate f874a3c85ab326928c042dbd544916f9 TRUNCATE TABLE truncat...
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index a3f83d551bd..fee6cf87173 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -458,6 +458,13 @@ void ha_partition::init_handler_variables()
}
+const char *ha_partition::real_table_type() const
+{
+ // we can do this since we only support a single engine type
+ return m_file[0]->table_type();
+}
+
+
/*
Destructor method
diff --git a/sql/json_table.cc b/sql/json_table.cc
index 2e890aa8c22..d778434d19a 100644
--- a/sql/json_table.cc
+++ b/sql/json_table.cc
@@ -693,6 +693,9 @@ bool Create_json_table::add_json_table_fields(THD *thd, TABLE *table,
thd->mem_root= &table->mem_root;
current_counter= other;
+ //psergey-todo:
+ const Column_derived_attributes dattr(&my_charset_utf8mb4_bin);
+
while ((jc= jc_i++))
{
Create_field *sql_f= jc->m_field;
@@ -708,7 +711,7 @@ bool Create_json_table::add_json_table_fields(THD *thd, TABLE *table,
sql_f->charset= &my_charset_utf8mb4_general_ci;
if (sql_f->prepare_stage1(thd, thd->mem_root, table->file,
- table->file->ha_table_flags()))
+ table->file->ha_table_flags(), &dattr))
goto err_exit;
while ((jc2= it2++) != jc)
@@ -868,7 +871,7 @@ int Json_table_column::print(THD *thd, Field **f, String *str)
switch (m_column_type)
{
case FOR_ORDINALITY:
- if (str->append("FOR ORDINALITY"))
+ if (str->append(STRING_WITH_LEN("FOR ORDINALITY")))
return 1;
break;
case EXISTS_PATH:
@@ -877,9 +880,11 @@ int Json_table_column::print(THD *thd, Field **f, String *str)
if (str->append(column_type) ||
((*f)->has_charset() && m_explicit_cs &&
- (str->append(" CHARSET ") || str->append(m_explicit_cs->csname))) ||
- str->append(m_column_type == PATH ? " PATH " : " EXISTS PATH ") ||
- print_path(str, &m_path))
+ (str->append(STRING_WITH_LEN(" CHARSET ")) ||
+ str->append(m_explicit_cs->cs_name))))
+ return 1;
+ const char *path= (m_column_type == PATH) ? " PATH " : " EXISTS PATH ";
+ if (str->append(path, strlen(path)) || print_path(str, &m_path))
return 1;
break;
};
@@ -970,12 +975,12 @@ int Json_table_column::On_response::print(const char *name, String *str) const
}
return
- (str->append(' ') || str->append(resp) ||
- (ds && (str->append(" '") ||
+ (str->append(' ') || str->append(resp, strlen(resp)) ||
+ (ds && (str->append(STRING_WITH_LEN(" '")) ||
str->append_for_single_quote(ds->str, ds->length) ||
str->append('\''))) ||
- str->append(" ON ") ||
- str->append(name));
+ str->append(STRING_WITH_LEN(" ON ")) ||
+ str->append(name, strlen(name)));
}
@@ -1171,7 +1176,7 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
Json_table_column *jc= *last_column;
bool first_column= TRUE;
- if (str->append("COLUMNS ("))
+ if (str->append(STRING_WITH_LEN("COLUMNS (")))
return 1;
/* loop while jc belongs to the current or nested paths. */
@@ -1180,7 +1185,7 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
{
if (first_column)
first_column= FALSE;
- else if (str->append(", "))
+ else if (str->append(STRING_WITH_LEN(", ")))
return 1;
if (jc->m_nest == c_path)
@@ -1193,7 +1198,7 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
else
{
DBUG_ASSERT(column_in_this_or_nested(c_nested, jc));
- if (str->append("NESTED PATH ") ||
+ if (str->append(STRING_WITH_LEN("NESTED PATH ")) ||
print_path(str, &jc->m_nest->m_path) ||
str->append(' ') ||
c_nested->print(thd, f, str, it, &jc))
@@ -1202,7 +1207,7 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
}
}
- if (str->append(")"))
+ if (str->append(')'))
return 1;
*last_column= jc;
@@ -1228,12 +1233,12 @@ int Table_function_json_table::print(THD *thd, TABLE_LIST *sql_table,
DBUG_ENTER("Table_function_json_table::print");
- if (str->append("JSON_TABLE("))
+ if (str->append(STRING_WITH_LEN("JSON_TABLE(")))
DBUG_RETURN(TRUE);
m_json->print(str, query_type);
- if (str->append(", ") ||
+ if (str->append(STRING_WITH_LEN(", ")) ||
print_path(str, &m_nested_path.m_path) ||
str->append(' ') ||
m_nested_path.print(thd, &f_list, str, jc_i, &jc) ||
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 348bea7573e..ae6400525d4 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7981,9 +7981,13 @@ ER_JSON_TABLE_ERROR_ON_FIELD
eng "Field '%s' can't be set for JSON_TABLE '%s'."
ER_JSON_TABLE_ALIAS_REQUIRED
eng "Every table function must have an alias."
+ER_ORACLE_COMPAT_FUNCTION_ERROR
+ eng "Oracle compatibility function error: %s"
+ER_REMOVED_ORPHAN_TRIGGER
+ eng "Dropped orphan trigger '%-.64s', originally created for table: '%-.192s'"
+ER_STORAGE_ENGINE_DISABLED
+ eng "Storage engine %s is disabled"
ER_JSON_TABLE_SCALAR_EXPECTED
eng "Can't store an array or an object in the scalar column '%s' of JSON_TABLE '%s'."
ER_JSON_TABLE_MULTIPLE_MATCHES
eng "Can't store multiple matches of the path in the column '%s' of JSON_TABLE '%s'."
-ER_STORAGE_ENGINE_DISABLED
- eng "Storage engine %s is disabled"
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index a06033b4c29..d13f175f706 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -2039,7 +2039,7 @@ void Explain_table_access::append_tag_name(String *str, enum explain_extra_tag t
str->append(STRING_WITH_LEN(" (scanning)"));
break;
case ET_TABLE_FUNCTION:
- str->append("Table function: json_table");
+ str->append(STRING_WITH_LEN("Table function: json_table"));
break;
}
default:
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 50fcbf6b86f..d32c35d4f68 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -202,7 +202,7 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()
{ \
if (unlikely(Lex->charset && !my_charset_same(Lex->charset,X))) \
my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0), \
- X->name,Lex->charset->csname)); \
+ X->cs_name,Lex->charset->cs_name)); \
Lex->charset= X; \
} \
} while(0)