Commit ecd23f62 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.6 into 10.9

parents b1317c17 46b79b8c
......@@ -234,6 +234,7 @@ connection default;
set debug_sync='now WAIT_FOR go0';
set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2';
kill $id;
select variable_value into @threads_cached from information_schema.global_status where variable_name='threads_cached';
set debug_sync='now SIGNAL go3';
drop table t1;
set debug_sync='reset';
......@@ -313,6 +313,12 @@ connection default;
set debug_sync='now WAIT_FOR go0';
set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2';
evalp kill $id;
select variable_value into @threads_cached from information_schema.global_status where variable_name='threads_cached';
set debug_sync='now SIGNAL go3';
if (`select @@thread_handling != 'pool-of-threads'`) {
# cannot check that a thread was added to thread pool on windows, but the test works there w/o the wait
let wait_condition= select variable_value>@threads_cached from information_schema.global_status where variable_name='threads_cached';
source include/wait_condition.inc;
}
drop table t1;
set debug_sync='reset';
......@@ -159,5 +159,23 @@ def j 250 (format=json) 9437283 16 Y 0 39 33
j
{"a": {"b":"c"}}
#
# MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT
#
# maintain JSON property through internal temporary tables
create table t1 (a varchar(30));
insert into t1 values ('root');
select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u;
json_object('attr2',o)
{"attr2": [{"attr1": "root"}]}
drop table t1;
create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json;
select v1_json from v1;
v1_json
{"a": "b"}
select json_arrayagg(v1_json) from v1;
json_arrayagg(v1_json)
[{"a": "b"}]
drop view v1;
#
# End of 10.5 tests
#
......@@ -121,6 +121,20 @@ SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) A
--disable_ps_protocol
--enable_view_protocol
--echo #
--echo # MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT
--echo #
--echo # maintain JSON property through internal temporary tables
create table t1 (a varchar(30));
insert into t1 values ('root');
select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u;
drop table t1;
create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json;
select v1_json from v1;
select json_arrayagg(v1_json) from v1;
drop view v1;
--echo #
--echo # End of 10.5 tests
--echo #
......@@ -23,7 +23,7 @@
#include <m_string.h>
#include <signal.h>
pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
pthread_key(struct st_my_thread_var*, THR_KEY_mysys=-1);
mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open,
THR_LOCK_lock, THR_LOCK_myisam, THR_LOCK_heap,
THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads,
......
......@@ -158,7 +158,7 @@ String *Item_func_inet6_aton::val_str(String *buffer)
return buffer;
}
Inet6Bundle::Fbt_null ipv6(*tmp.string());
Type_handler_inet6::Fbt_null ipv6(*tmp.string());
if (!ipv6.is_null())
{
ipv6.to_binary(buffer);
......@@ -197,7 +197,7 @@ String *Item_func_inet6_ntoa::val_str_ascii(String *buffer)
return buffer;
}
Inet6Bundle::Fbt_null ipv6(static_cast<const Binary_string&>(*tmp.string()));
Type_handler_inet6::Fbt_null ipv6(static_cast<const Binary_string&>(*tmp.string()));
if (!ipv6.is_null())
{
ipv6.to_string(buffer);
......@@ -221,10 +221,10 @@ longlong Item_func_is_ipv4::val_int()
return !tmp.is_null() && !Inet4_null(*tmp.string()).is_null();
}
class IP6 : public Inet6Bundle::Fbt_null
class IP6 : public Type_handler_inet6::Fbt_null
{
public:
IP6(Item* arg) : Inet6Bundle::Fbt_null(arg) {}
IP6(Item* arg) : Type_handler_inet6::Fbt_null(arg) {}
bool is_v4compat() const
{
static_assert(sizeof(in6_addr) == IN6_ADDR_SIZE, "unexpected in6_addr size");
......@@ -246,7 +246,7 @@ longlong Item_func_is_ipv6::val_int()
{
DBUG_ASSERT(fixed());
String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
return !tmp.is_null() && !Inet6Bundle::Fbt_null(*tmp.string()).is_null();
return !tmp.is_null() && !Type_handler_inet6::Fbt_null(*tmp.string()).is_null();
}
/**
......
......@@ -24,7 +24,7 @@
static struct st_mariadb_data_type plugin_descriptor_type_inet6=
{
MariaDB_DATA_TYPE_INTERFACE_VERSION,
Inet6Bundle::type_handler_fbt()
Type_handler_inet6::singleton()
};
......
......@@ -44,7 +44,7 @@ class Inet6: public FixedBinTypeStorage<IN6_ADDR_SIZE, IN6_ADDR_MAX_CHAR_LENGTH>
#include "sql_type_fixedbin.h"
typedef FixedBinTypeBundle<Inet6> Inet6Bundle;
typedef Type_handler_fbt<Inet6> Type_handler_inet6;
/***********************************************************************/
......
......@@ -188,13 +188,6 @@ class Type_collection_mysql_json: public Type_collection
{
return NULL;
}
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
{
if (type_handler_mysql_json.name().eq(name))
return &type_handler_mysql_json;
return NULL;
}
};
const Type_collection *Type_handler_mysql_json::type_collection() const
......
......@@ -26,11 +26,6 @@ class Type_collection_local: public Type_collection
const Type_handler *aggregate_common(const Type_handler *h1,
const Type_handler *h2) const;
public:
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
{
return NULL;
}
const Type_handler *aggregate_for_result(const Type_handler *h1,
const Type_handler *h2)
const override
......
......@@ -26,10 +26,6 @@ class Type_collection_test: public Type_collection
const Type_handler *aggregate_common(const Type_handler *h1,
const Type_handler *h2) const;
public:
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
{
return NULL;
}
const Type_handler *aggregate_for_result(const Type_handler *h1,
const Type_handler *h2)
const override;
......
......@@ -33,7 +33,7 @@ String *Item_func_sys_guid::val_str(String *str)
const Type_handler *Item_func_uuid::type_handler() const
{
return UUIDBundle::type_handler_fbt();
return UUIDBundle::singleton();
}
bool Item_func_uuid::val_native(THD *, Native *to)
......
......@@ -24,7 +24,7 @@
static struct st_mariadb_data_type plugin_descriptor_type_uuid=
{
MariaDB_DATA_TYPE_INTERFACE_VERSION,
UUIDBundle::type_handler_fbt()
UUIDBundle::singleton()
};
/*************************************************************************/
......
......@@ -181,6 +181,6 @@ class UUID: public FixedBinTypeStorage<MY_UUID_SIZE, MY_UUID_STRING_LENGTH>
#include "sql_type_fixedbin.h"
typedef FixedBinTypeBundle<UUID> UUIDBundle;
typedef Type_handler_fbt<UUID> UUIDBundle;
#endif // SQL_TYPE_UUID_INCLUDED
......@@ -677,7 +677,7 @@ bool String::append_with_prefill(const char *s,uint32 arg_length,
}
int Binary_string::strstr(const char *search, uint32 search_length, uint32 offset)
int Binary_string::strstr(const char *search, uint32 search_length, uint32 offset) const
{
if (search_length + offset <= str_length)
{
......@@ -703,7 +703,7 @@ int Binary_string::strstr(const char *search, uint32 search_length, uint32 offse
return -1;
}
int Binary_string::strstr(const Binary_string &s, uint32 offset)
int Binary_string::strstr(const Binary_string &s, uint32 offset) const
{
return strstr(s.ptr(), s.length(), offset);
}
......@@ -712,7 +712,7 @@ int Binary_string::strstr(const Binary_string &s, uint32 offset)
** Search string from end. Offset is offset to the end of string
*/
int Binary_string::strrstr(const Binary_string &s, uint32 offset)
int Binary_string::strrstr(const Binary_string &s, uint32 offset) const
{
if (s.length() <= offset && offset <= str_length)
{
......
......@@ -406,10 +406,10 @@ class Binary_string: public Sql_alloc
}
// Returns offset to substring or -1
int strstr(const Binary_string &search, uint32 offset=0);
int strstr(const char *search, uint32 search_length, uint32 offset=0);
int strstr(const Binary_string &search, uint32 offset=0) const;
int strstr(const char *search, uint32 search_length, uint32 offset=0) const;
// Returns offset to substring or -1
int strrstr(const Binary_string &search, uint32 offset=0);
int strrstr(const Binary_string &search, uint32 offset=0) const;
/*
The following append operations do not extend the strings and in production
......
......@@ -94,10 +94,6 @@ Vers_type_trx vers_type_trx;
class Type_collection_std: public Type_collection
{
public:
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
{
return NULL;
}
const Type_handler *aggregate_for_result(const Type_handler *a,
const Type_handler *b)
const override
......@@ -137,10 +133,6 @@ class Type_collection_row: public Type_collection
{
return false;
}
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
{
return NULL;
}
const Type_handler *aggregate_for_result(const Type_handler *a,
const Type_handler *b)
const override
......@@ -212,7 +204,7 @@ Type_handler::handler_by_name(THD *thd, const LEX_CSTRING &name)
}
#ifdef HAVE_SPATIAL
const Type_handler *ha= type_collection_geometry.handler_by_name(name);
const Type_handler *ha= Type_collection_geometry_handler_by_name(name);
if (ha)
return ha;
#endif
......
......@@ -7396,7 +7396,6 @@ class Type_collection
public:
virtual ~Type_collection() = default;
virtual bool init(Type_handler_data *) { return false; }
virtual const Type_handler *handler_by_name(const LEX_CSTRING &name) const= 0;
virtual const Type_handler *aggregate_for_result(const Type_handler *h1,
const Type_handler *h2)
const= 0;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -67,7 +67,7 @@ Type_handler_geometry::type_handler_geom_by_type(uint type)
const Type_handler *
Type_collection_geometry::handler_by_name(const LEX_CSTRING &name) const
Type_collection_geometry_handler_by_name(const LEX_CSTRING &name)
{
if (type_handler_point.name().eq(name))
return &type_handler_point;
......
......@@ -296,7 +296,6 @@ class Type_collection_geometry: public Type_collection
#endif
public:
bool init(Type_handler_data *data) override;
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override;
const Type_handler *aggregate_for_result(const Type_handler *a,
const Type_handler *b)
const override;
......@@ -315,6 +314,8 @@ class Type_collection_geometry: public Type_collection
};
extern Type_collection_geometry type_collection_geometry;
const Type_handler *
Type_collection_geometry_handler_by_name(const LEX_CSTRING &name);
#include "field.h"
......
......@@ -233,20 +233,6 @@ class Type_collection_json: public Type_collection
*/
return NULL;
}
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
{
/*
Name resolution is not needed yet.
JSON is not fully pluggable at the moment:
- It is parsed using a hard-coded rule in sql_yacc.yy
- It does not store extended data type information into
FRM file yet. JSON is detected by CHECK(JSON_VALID(col))
and this detection is also hard-coded.
This will change in the future.
*/
return NULL;
}
};
......
......@@ -1320,6 +1320,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
sp_opt_label BIN_NUM TEXT_STRING_filesystem
opt_constraint constraint opt_ident
sp_block_label sp_control_label opt_place opt_db
udt_name
%type <ident_sys>
IDENT_sys
......@@ -6022,23 +6023,19 @@ qualified_field_type:
}
;
udt_name:
IDENT_sys { $$= $1; }
| reserved_keyword_udt { $$= $1; }
| non_reserved_keyword_udt { $$= $1; }
;
field_type_all:
field_type_numeric
| field_type_temporal
| field_type_string
| field_type_lob
| field_type_misc
| IDENT_sys float_options srid_option
{
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
| reserved_keyword_udt float_options srid_option
{
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
| non_reserved_keyword_udt float_options srid_option
| udt_name float_options srid_option
{
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
......@@ -11189,17 +11186,7 @@ cast_type:
}
| cast_type_numeric { $$= $1; }
| cast_type_temporal { $$= $1; }
| IDENT_sys
{
if (Lex->set_cast_type_udt(&$$, $1))
MYSQL_YYABORT;
}
| reserved_keyword_udt
{
if (Lex->set_cast_type_udt(&$$, $1))
MYSQL_YYABORT;
}
| non_reserved_keyword_udt
| udt_name
{
if (Lex->set_cast_type_udt(&$$, $1))
MYSQL_YYABORT;
......
......@@ -514,15 +514,17 @@ static bool dict_stats_persistent_storage_check(bool dict_already_locked)
dict_sys.unlock();
}
if (ret != DB_SUCCESS && ret != DB_STATS_DO_NOT_EXIST) {
ib::error() << errstr;
return(false);
} else if (ret == DB_STATS_DO_NOT_EXIST) {
switch (ret) {
case DB_SUCCESS:
return true;
default:
if (!opt_bootstrap) {
ib::error() << errstr;
}
/* fall through */
case DB_STATS_DO_NOT_EXIST:
return false;
}
/* else */
return(true);
}
/** Executes a given SQL statement using the InnoDB internal SQL parser.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment