summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-04-06 13:00:09 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-04-06 13:00:09 +0300
commit2d8e38bc9477aa00b371ed14d95390bede70c5cb (patch)
tree7d4e4e22138572b769263994697d69bd141c5bf3 /sql
parentb249abde57f1788a8085f45cc6252ee70ece3354 (diff)
parent4e1ca388381eea27a9275571744ad17ce317b273 (diff)
downloadmariadb-git-2d8e38bc9477aa00b371ed14d95390bede70c5cb.tar.gz
Merge 10.6 into 10.7
Diffstat (limited to 'sql')
-rw-r--r--sql/datadict.cc11
-rw-r--r--sql/events.cc1
-rw-r--r--sql/ha_partition.h6
-rw-r--r--sql/handler.cc204
-rw-r--r--sql/handler.h90
-rw-r--r--sql/item_create.cc311
-rw-r--r--sql/item_create.h36
-rw-r--r--sql/item_geofunc.cc44
-rw-r--r--sql/share/errmsg-utf8.txt11
-rw-r--r--sql/sql_lex.cc6
-rw-r--r--sql/sql_parse.cc55
-rw-r--r--sql/sql_select.cc6
-rw-r--r--sql/sql_sequence.cc2
-rw-r--r--sql/sql_show.cc12
-rw-r--r--sql/sql_trigger.cc12
-rw-r--r--sql/sql_yacc.yy10
-rw-r--r--sql/table.cc24
-rw-r--r--sql/wsrep_sst.cc84
18 files changed, 383 insertions, 542 deletions
diff --git a/sql/datadict.cc b/sql/datadict.cc
index b2c4b615c4d..e85478a710c 100644
--- a/sql/datadict.cc
+++ b/sql/datadict.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2017, 2022, MariaDB corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -105,16 +106,12 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
goto err;
}
- /* engine_name is 0 if we only want to know if table is view or not */
- if (!engine_name)
- goto err;
-
if (!is_binary_frm_header(header))
goto err;
dbt= header[3];
- if (((header[39] >> 4) & 3) == HA_CHOICE_YES)
+ if ((header[39] & 0x30) == (HA_CHOICE_YES << 4))
{
DBUG_PRINT("info", ("Sequence found"));
type= TABLE_TYPE_SEQUENCE;
@@ -134,7 +131,8 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
handlerton *ht= ha_resolve_by_legacy_type(thd, (legacy_db_type) dbt);
if (ht)
{
- *engine_name= hton2plugin[ht->slot]->name;
+ if (engine_name)
+ *engine_name= hton2plugin[ht->slot]->name;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_engine_name && dbt == DB_TYPE_PARTITION_DB)
{
@@ -155,6 +153,7 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
cont:
#endif
/* read the true engine name */
+ if (engine_name)
{
MY_STAT state;
uchar *frm_image= 0;
diff --git a/sql/events.cc b/sql/events.cc
index 213f634fde0..1c185a8d489 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -670,6 +670,7 @@ Events::drop_schema_events(THD *thd, const char *db)
{
db_repository->drop_schema_events(thd, &db_lex);
delete db_repository;
+ db_repository= 0;
}
}
DBUG_VOID_RETURN;
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index dd14cd7a6d4..29763447e6e 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -3,7 +3,7 @@
/*
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
- Copyright (c) 2009, 2021, MariaDB Corporation.
+ Copyright (c) 2009, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1108,10 +1108,6 @@ public:
NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION
LEVEL which is dynamic, see bug#39084.
- HA_READ_RND_SAME:
- Not currently used. (Means that the handler supports the rnd_same() call)
- (MyISAM, HEAP)
-
HA_TABLE_SCAN_ON_INDEX:
Used to avoid scanning full tables on an index. If this flag is set then
the handler always has a primary key (hidden if not defined) and this
diff --git a/sql/handler.cc b/sql/handler.cc
index 3f15fa04d6e..e04aedbcd38 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2021, MariaDB Corporation.
+ Copyright (c) 2009, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -932,6 +932,22 @@ void ha_kill_query(THD* thd, enum thd_kill_levels level)
}
+static my_bool plugin_disable_internal_writes(THD *, plugin_ref plugin,
+ void *disable)
+{
+ if (void(*diw)(bool)= plugin_hton(plugin)->disable_internal_writes)
+ diw(*static_cast<bool*>(disable));
+ return FALSE;
+}
+
+
+void ha_disable_internal_writes(bool disable)
+{
+ plugin_foreach(NULL, plugin_disable_internal_writes,
+ MYSQL_STORAGE_ENGINE_PLUGIN, &disable);
+}
+
+
static my_bool signal_ddl_recovery_done(THD *, plugin_ref plugin, void *)
{
handlerton *hton= plugin_hton(plugin);
@@ -6089,7 +6105,9 @@ int ha_discover_table(THD *thd, TABLE_SHARE *share)
else
found= plugin_foreach(thd, discover_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN, share);
-
+
+ if (thd->lex->query_tables && thd->lex->query_tables->sequence && !found)
+ my_error(ER_UNKNOWN_SEQUENCES, MYF(0),share->table_name.str);
if (!found)
open_table_error(share, OPEN_FRM_OPEN_ERROR, ENOENT); // not found
@@ -7826,17 +7844,6 @@ void handler::unlock_shared_ha_data()
mysql_mutex_unlock(&table_share->LOCK_ha_data);
}
-/** @brief
- Dummy function which accept information about log files which is not need
- by handlers
-*/
-void signal_log_not_needed(struct handlerton, char *log_file)
-{
- DBUG_ENTER("signal_log_not_needed");
- DBUG_PRINT("enter", ("logfile '%s'", log_file));
- DBUG_VOID_RETURN;
-}
-
void handler::set_lock_type(enum thr_lock_type lock)
{
table->reginfo.lock_type= lock;
@@ -7905,177 +7912,6 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
#endif /* WITH_WSREP */
-#ifdef TRANS_LOG_MGM_EXAMPLE_CODE
-/*
- Example of transaction log management functions based on assumption that logs
- placed into a directory
-*/
-#include <my_dir.h>
-#include <my_sys.h>
-int example_of_iterator_using_for_logs_cleanup(handlerton *hton)
-{
- void *buffer;
- int res= 1;
- struct handler_iterator iterator;
- struct handler_log_file_data data;
-
- if (!hton->create_iterator)
- return 1; /* iterator creator is not supported */
-
- if ((*hton->create_iterator)(hton, HA_TRANSACTLOG_ITERATOR, &iterator) !=
- HA_ITERATOR_OK)
- {
- /* error during creation of log iterator or iterator is not supported */
- return 1;
- }
- while((*iterator.next)(&iterator, (void*)&data) == 0)
- {
- printf("%s\n", data.filename.str);
- if (data.status == HA_LOG_STATUS_FREE &&
- mysql_file_delete(INSTRUMENT_ME,
- data.filename.str, MYF(MY_WME)))
- goto err;
- }
- res= 0;
-err:
- (*iterator.destroy)(&iterator);
- return res;
-}
-
-
-/*
- Here we should get info from handler where it save logs but here is
- just example, so we use constant.
- IMHO FN_ROOTDIR ("/") is safe enough for example, because nobody has
- rights on it except root and it consist of directories only at lest for
- *nix (sorry, can't find windows-safe solution here, but it is only example).
-*/
-#define fl_dir FN_ROOTDIR
-
-
-/** @brief
- Dummy function to return log status should be replaced by function which
- really detect the log status and check that the file is a log of this
- handler.
-*/
-enum log_status fl_get_log_status(char *log)
-{
- MY_STAT stat_buff;
- if (mysql_file_stat(INSTRUMENT_ME, log, &stat_buff, MYF(0)))
- return HA_LOG_STATUS_INUSE;
- return HA_LOG_STATUS_NOSUCHLOG;
-}
-
-
-struct fl_buff
-{
- LEX_STRING *names;
- enum log_status *statuses;
- uint32 entries;
- uint32 current;
-};
-
-
-int fl_log_iterator_next(struct handler_iterator *iterator,
- void *iterator_object)
-{
- struct fl_buff *buff= (struct fl_buff *)iterator->buffer;
- struct handler_log_file_data *data=
- (struct handler_log_file_data *) iterator_object;
- if (buff->current >= buff->entries)
- return 1;
- data->filename= buff->names[buff->current];
- data->status= buff->statuses[buff->current];
- buff->current++;
- return 0;
-}
-
-
-void fl_log_iterator_destroy(struct handler_iterator *iterator)
-{
- my_free(iterator->buffer);
-}
-
-
-/** @brief
- returns buffer, to be assigned in handler_iterator struct
-*/
-enum handler_create_iterator_result
-fl_log_iterator_buffer_init(struct handler_iterator *iterator)
-{
- MY_DIR *dirp;
- struct fl_buff *buff;
- char *name_ptr;
- uchar *ptr;
- FILEINFO *file;
- uint32 i;
-
- /* to be able to make my_free without crash in case of error */
- iterator->buffer= 0;
-
- if (!(dirp = my_dir(fl_dir, MYF(MY_THREAD_SPECIFIC))))
- {
- return HA_ITERATOR_ERROR;
- }
- if ((ptr= (uchar*)my_malloc(ALIGN_SIZE(sizeof(fl_buff)) +
- ((ALIGN_SIZE(sizeof(LEX_STRING)) +
- sizeof(enum log_status) +
- + FN_REFLEN + 1) *
- (uint) dirp->number_off_files),
- MYF(MY_THREAD_SPECIFIC))) == 0)
- {
- return HA_ITERATOR_ERROR;
- }
- buff= (struct fl_buff *)ptr;
- buff->entries= buff->current= 0;
- ptr= ptr + (ALIGN_SIZE(sizeof(fl_buff)));
- buff->names= (LEX_STRING*) (ptr);
- ptr= ptr + ((ALIGN_SIZE(sizeof(LEX_STRING)) *
- (uint) dirp->number_off_files));
- buff->statuses= (enum log_status *)(ptr);
- name_ptr= (char *)(ptr + (sizeof(enum log_status) *
- (uint) dirp->number_off_files));
- for (i=0 ; i < (uint) dirp->number_off_files ; i++)
- {
- enum log_status st;
- file= dirp->dir_entry + i;
- if ((file->name[0] == '.' &&
- ((file->name[1] == '.' && file->name[2] == '\0') ||
- file->name[1] == '\0')))
- continue;
- if ((st= fl_get_log_status(file->name)) == HA_LOG_STATUS_NOSUCHLOG)
- continue;
- name_ptr= strxnmov(buff->names[buff->entries].str= name_ptr,
- FN_REFLEN, fl_dir, file->name, NullS);
- buff->names[buff->entries].length= (name_ptr -
- buff->names[buff->entries].str);
- buff->statuses[buff->entries]= st;
- buff->entries++;
- }
-
- iterator->buffer= buff;
- iterator->next= &fl_log_iterator_next;
- iterator->destroy= &fl_log_iterator_destroy;
- my_dirend(dirp);
- return HA_ITERATOR_OK;
-}
-
-
-/* An example of a iterator creator */
-enum handler_create_iterator_result
-fl_create_iterator(enum handler_iterator_type type,
- struct handler_iterator *iterator)
-{
- switch(type) {
- case HA_TRANSACTLOG_ITERATOR:
- return fl_log_iterator_buffer_init(iterator);
- default:
- return HA_ITERATOR_UNSUPPORTED;
- }
-}
-#endif /*TRANS_LOG_MGM_EXAMPLE_CODE*/
-
-
bool HA_CREATE_INFO::check_conflicting_charset_declarations(CHARSET_INFO *cs)
{
if ((used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
diff --git a/sql/handler.h b/sql/handler.h
index 1f96c35ed6b..e8960d095e5 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1069,31 +1069,6 @@ extern MYSQL_PLUGIN_IMPORT st_plugin_int *hton2plugin[MAX_HA];
struct handlerton;
#define view_pseudo_hton ((handlerton *)1)
-/* Transaction log maintains type definitions */
-enum log_status
-{
- HA_LOG_STATUS_FREE= 0, /* log is free and can be deleted */
- HA_LOG_STATUS_INUSE= 1, /* log can't be deleted because it is in use */
- HA_LOG_STATUS_NOSUCHLOG= 2 /* no such log (can't be returned by
- the log iterator status) */
-};
-/*
- Function for signaling that the log file changed its state from
- LOG_STATUS_INUSE to LOG_STATUS_FREE
-
- Now it do nothing, will be implemented as part of new transaction
- log management for engines.
- TODO: implement the function.
-*/
-void signal_log_not_needed(struct handlerton, char *log_file);
-/*
- Data of transaction log iterator.
-*/
-struct handler_log_file_data {
- LEX_STRING filename;
- enum log_status status;
-};
-
/*
Definitions for engine-specific table/field/index options in the CREATE TABLE.
@@ -1208,46 +1183,6 @@ typedef struct st_ha_create_table_option {
struct st_mysql_sys_var *var;
} ha_create_table_option;
-enum handler_iterator_type
-{
- /* request of transaction log iterator */
- HA_TRANSACTLOG_ITERATOR= 1
-};
-enum handler_create_iterator_result
-{
- HA_ITERATOR_OK, /* iterator created */
- HA_ITERATOR_UNSUPPORTED, /* such type of iterator is not supported */
- HA_ITERATOR_ERROR /* error during iterator creation */
-};
-
-/*
- Iterator structure. Can be used by handler/handlerton for different purposes.
-
- Iterator should be created in the way to point "before" the first object
- it iterate, so next() call move it to the first object or return !=0 if
- there is nothing to iterate through.
-*/
-struct handler_iterator {
- /*
- Moves iterator to next record and return 0 or return !=0
- if there is no records.
- iterator_object will be filled by this function if next() returns 0.
- Content of the iterator_object depend on iterator type.
- */
- int (*next)(struct handler_iterator *, void *iterator_object);
- /*
- Free resources allocated by iterator, after this call iterator
- is not usable.
- */
- void (*destroy)(struct handler_iterator *);
- /*
- Pointer to buffer for the iterator to use.
- Should be allocated by function which created the iterator and
- destroyed by freed by above "destroy" call
- */
- void *buffer;
-};
-
class handler;
class group_by_handler;
class derived_handler;
@@ -1511,22 +1446,6 @@ struct handlerton
const char *query, uint query_length,
const char *db, const char *table_name);
- /*
- Get log status.
- If log_status is null then the handler do not support transaction
- log information (i.e. log iterator can't be created).
- (see example of implementation in handler.cc, TRANS_LOG_MGM_EXAMPLE_CODE)
-
- */
- enum log_status (*get_log_status)(handlerton *hton, char *log);
-
- /*
- Iterators creator.
- Presence of the pointer should be checked before using
- */
- enum handler_create_iterator_result
- (*create_iterator)(handlerton *hton, enum handler_iterator_type type,
- struct handler_iterator *fill_this_in);
void (*abort_transaction)(handlerton *hton, THD *bf_thd,
THD *victim_thd, my_bool signal);
int (*set_checkpoint)(handlerton *hton, const XID* xid);
@@ -1723,6 +1642,9 @@ struct handlerton
@retval 0 if no system-versioned data was affected by the transaction */
ulonglong (*prepare_commit_versioned)(THD *thd, ulonglong *trx_id);
+ /** Disable or enable the internal writes of a storage engine */
+ void (*disable_internal_writes)(bool disable);
+
/* backup */
void (*prepare_for_backup)(void);
void (*end_backup)(void);
@@ -4069,15 +3991,13 @@ public:
inline int ha_read_first_row(uchar *buf, uint primary_key);
/**
- The following 3 function is only needed for tables that may be
+ The following 2 function is only needed for tables that may be
internal temporary tables during joins.
*/
virtual int remember_rnd_pos()
{ return HA_ERR_WRONG_COMMAND; }
virtual int restart_rnd_next(uchar *buf)
{ return HA_ERR_WRONG_COMMAND; }
- virtual int rnd_same(uchar *buf, uint inx)
- { return HA_ERR_WRONG_COMMAND; }
virtual ha_rows records_in_range(uint inx, const key_range *min_key,
const key_range *max_key,
@@ -5290,6 +5210,8 @@ void ha_prepare_for_backup();
void ha_end_backup();
void ha_pre_shutdown();
+void ha_disable_internal_writes(bool disable);
+
/* statistics and info */
bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat);
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 1aa7d02e76b..a2fe1542cb9 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008, 2021, MariaDB Corporation.
+ Copyright (c) 2008, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -81,7 +81,9 @@ extern Native_func_registry_array native_func_registry_array_geom;
class Create_sp_func : public Create_qfunc
{
public:
- virtual Item *create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name,
+ virtual Item *create_with_db(THD *thd,
+ const LEX_CSTRING *db,
+ const LEX_CSTRING *name,
bool use_explicit_name, List<Item> *item_list);
static Create_sp_func s_singleton;
@@ -181,7 +183,8 @@ protected:
class Create_func_atan : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_atan s_singleton;
@@ -372,7 +375,8 @@ protected:
class Create_func_concat : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_concat s_singleton;
@@ -385,7 +389,8 @@ protected:
class Create_func_concat_operator_oracle : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_concat_operator_oracle s_singleton;
@@ -411,7 +416,8 @@ protected:
class Create_func_decode_oracle : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_decode_oracle s_singleton;
@@ -424,7 +430,8 @@ protected:
class Create_func_concat_ws : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_concat_ws s_singleton;
@@ -606,7 +613,8 @@ protected:
class Create_func_des_decrypt : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_des_decrypt s_singleton;
@@ -619,7 +627,8 @@ protected:
class Create_func_des_encrypt : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_des_encrypt s_singleton;
@@ -632,7 +641,8 @@ protected:
class Create_func_elt : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_elt s_singleton;
@@ -658,7 +668,8 @@ protected:
class Create_func_encrypt : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_encrypt s_singleton;
@@ -684,7 +695,8 @@ protected:
class Create_func_export_set : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_export_set s_singleton;
@@ -697,7 +709,8 @@ protected:
class Create_func_field : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_field s_singleton;
@@ -736,7 +749,8 @@ protected:
class Create_func_format : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_format s_singleton;
@@ -788,7 +802,8 @@ protected:
class Create_func_from_unixtime : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_from_unixtime s_singleton;
@@ -814,7 +829,8 @@ protected:
class Create_func_greatest : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_greatest s_singleton;
@@ -983,7 +999,8 @@ protected:
class Create_func_json_detailed: public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_detailed s_singleton;
@@ -1048,7 +1065,8 @@ protected:
class Create_func_json_keys: public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_keys s_singleton;
@@ -1061,7 +1079,8 @@ protected:
class Create_func_json_contains: public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_contains s_singleton;
@@ -1074,7 +1093,8 @@ protected:
class Create_func_json_contains_path : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_contains_path s_singleton;
@@ -1087,7 +1107,8 @@ protected:
class Create_func_json_extract : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_extract s_singleton;
@@ -1100,7 +1121,8 @@ protected:
class Create_func_json_search : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_search s_singleton;
@@ -1113,7 +1135,8 @@ protected:
class Create_func_json_array : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_array s_singleton;
@@ -1126,7 +1149,8 @@ protected:
class Create_func_json_array_append : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_array_append s_singleton;
@@ -1139,7 +1163,8 @@ protected:
class Create_func_json_array_insert : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_array_insert s_singleton;
@@ -1152,7 +1177,8 @@ protected:
class Create_func_json_insert : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_insert s_singleton;
@@ -1165,7 +1191,8 @@ protected:
class Create_func_json_set : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_set s_singleton;
@@ -1178,7 +1205,8 @@ protected:
class Create_func_json_replace : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_replace s_singleton;
@@ -1191,7 +1219,8 @@ protected:
class Create_func_json_remove : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_remove s_singleton;
@@ -1204,7 +1233,8 @@ protected:
class Create_func_json_object : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_object s_singleton;
@@ -1217,7 +1247,8 @@ protected:
class Create_func_json_length : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_length s_singleton;
@@ -1230,7 +1261,8 @@ protected:
class Create_func_json_merge : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_merge s_singleton;
@@ -1243,7 +1275,8 @@ protected:
class Create_func_json_merge_patch : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_json_merge_patch s_singleton;
@@ -1295,7 +1328,8 @@ protected:
class Create_func_last_insert_id : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_last_insert_id s_singleton;
@@ -1321,7 +1355,8 @@ protected:
class Create_func_least : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_least s_singleton;
@@ -1413,7 +1448,8 @@ protected:
class Create_func_locate : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_locate s_singleton;
@@ -1426,7 +1462,8 @@ protected:
class Create_func_log : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_log s_singleton;
@@ -1465,7 +1502,7 @@ protected:
class Create_func_lpad : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name,
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
return thd->variables.sql_mode & MODE_ORACLE ?
@@ -1477,15 +1514,18 @@ public:
protected:
Create_func_lpad() {}
virtual ~Create_func_lpad() {}
- Item *create_native_std(THD *thd, LEX_CSTRING *name, List<Item> *items);
- Item *create_native_oracle(THD *thd, LEX_CSTRING *name, List<Item> *items);
+ Item *create_native_std(THD *thd, const LEX_CSTRING *name,
+ List<Item> *items);
+ Item *create_native_oracle(THD *thd, const LEX_CSTRING *name,
+ List<Item> *items);
};
class Create_func_lpad_oracle : public Create_func_lpad
{
public:
- Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+ Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
return create_native_oracle(thd, name, item_list);
}
@@ -1548,7 +1588,8 @@ protected:
class Create_func_make_set : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_make_set s_singleton;
@@ -1561,7 +1602,8 @@ protected:
class Create_func_master_pos_wait : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_master_pos_wait s_singleton;
@@ -1574,7 +1616,8 @@ protected:
class Create_func_master_gtid_wait : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_master_gtid_wait s_singleton;
@@ -1791,7 +1834,8 @@ protected:
class Create_func_rand : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_rand s_singleton;
@@ -1852,7 +1896,8 @@ protected:
class Create_func_round : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_round s_singleton;
@@ -1865,7 +1910,7 @@ protected:
class Create_func_rpad : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name,
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
return thd->variables.sql_mode & MODE_ORACLE ?
@@ -1877,15 +1922,18 @@ public:
protected:
Create_func_rpad() {}
virtual ~Create_func_rpad() {}
- Item *create_native_std(THD *thd, LEX_CSTRING *name, List<Item> *items);
- Item *create_native_oracle(THD *thd, LEX_CSTRING *name, List<Item> *items);
+ Item *create_native_std(THD *thd, const LEX_CSTRING *name,
+ List<Item> *items);
+ Item *create_native_oracle(THD *thd, const LEX_CSTRING *name,
+ List<Item> *items);
};
class Create_func_rpad_oracle : public Create_func_rpad
{
public:
- Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+ Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
return create_native_oracle(thd, name, item_list);
}
@@ -1934,8 +1982,8 @@ protected:
class Create_func_sformat : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list);
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
static Create_func_sformat s_singleton;
protected:
Create_func_sformat() {}
@@ -2088,7 +2136,7 @@ protected:
class Create_func_substr_oracle : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name,
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list);
static Create_func_substr_oracle s_singleton;
@@ -2180,7 +2228,8 @@ protected:
class Create_func_to_char : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
static Create_func_to_char s_singleton;
@@ -2270,7 +2319,8 @@ protected:
class Create_func_unix_timestamp : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_unix_timestamp s_singleton;
@@ -2362,7 +2412,8 @@ protected:
class Create_func_wsrep_sync_wait_upto : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
static Create_func_wsrep_sync_wait_upto s_singleton;
@@ -2402,7 +2453,8 @@ protected:
class Create_func_year_week : public Create_native_func
{
public:
- virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list);
static Create_func_year_week s_singleton;
@@ -2443,7 +2495,8 @@ static bool has_named_parameters(List<Item> *params)
Item*
-Create_qfunc::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+Create_qfunc::create_func(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
LEX_CSTRING db;
@@ -2476,7 +2529,8 @@ Create_qfunc::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
Create_udf_func Create_udf_func::s_singleton;
Item*
-Create_udf_func::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+Create_udf_func::create_func(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
udf_func *udf= find_udf(name->str, name->length);
DBUG_ASSERT(udf);
@@ -2586,7 +2640,9 @@ Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list)
Create_sp_func Create_sp_func::s_singleton;
Item*
-Create_sp_func::create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name,
+Create_sp_func::create_with_db(THD *thd,
+ const LEX_CSTRING *db,
+ const LEX_CSTRING *name,
bool use_explicit_name, List<Item> *item_list)
{
int arg_count= 0;
@@ -2633,7 +2689,8 @@ Create_sp_func::create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name,
Item*
-Create_native_func::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+Create_native_func::create_func(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
if (unlikely(has_named_parameters(item_list)))
{
@@ -2646,7 +2703,8 @@ Create_native_func::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_li
Item*
-Create_func_arg0::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+Create_func_arg0::create_func(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
int arg_count= 0;
@@ -2664,7 +2722,8 @@ Create_func_arg0::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list
Item*
-Create_func_arg1::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+Create_func_arg1::create_func(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
int arg_count= 0;
@@ -2690,7 +2749,8 @@ Create_func_arg1::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list
Item*
-Create_func_arg2::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+Create_func_arg2::create_func(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
int arg_count= 0;
@@ -2718,7 +2778,8 @@ Create_func_arg2::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list
Item*
-Create_func_arg3::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
+Create_func_arg3::create_func(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
int arg_count= 0;
@@ -2804,7 +2865,7 @@ Create_func_asin::create_1_arg(THD *thd, Item *arg1)
Create_func_atan Create_func_atan::s_singleton;
Item*
-Create_func_atan::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_atan::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item* func= NULL;
@@ -2966,7 +3027,7 @@ Create_func_dyncol_json::create_1_arg(THD *thd, Item *arg1)
Create_func_concat Create_func_concat::s_singleton;
Item*
-Create_func_concat::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_concat::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -2989,7 +3050,7 @@ Create_func_concat_operator_oracle
Create_func_concat_operator_oracle::s_singleton;
Item*
-Create_func_concat_operator_oracle::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_concat_operator_oracle::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -3017,7 +3078,7 @@ Create_func_decode_histogram::create_2_arg(THD *thd, Item *arg1, Item *arg2)
Create_func_decode_oracle Create_func_decode_oracle::s_singleton;
Item*
-Create_func_decode_oracle::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_decode_oracle::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
uint arg_count= item_list ? item_list->elements : 0;
@@ -3032,7 +3093,7 @@ Create_func_decode_oracle::create_native(THD *thd, LEX_CSTRING *name,
Create_func_concat_ws Create_func_concat_ws::s_singleton;
Item*
-Create_func_concat_ws::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_concat_ws::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -3184,7 +3245,7 @@ Create_func_degrees::create_1_arg(THD *thd, Item *arg1)
Create_func_des_decrypt Create_func_des_decrypt::s_singleton;
Item*
-Create_func_des_decrypt::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_des_decrypt::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3221,7 +3282,7 @@ Create_func_des_decrypt::create_native(THD *thd, LEX_CSTRING *name,
Create_func_des_encrypt Create_func_des_encrypt::s_singleton;
Item*
-Create_func_des_encrypt::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_des_encrypt::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3258,7 +3319,7 @@ Create_func_des_encrypt::create_native(THD *thd, LEX_CSTRING *name,
Create_func_elt Create_func_elt::s_singleton;
Item*
-Create_func_elt::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_elt::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -3288,7 +3349,7 @@ Create_func_encode::create_2_arg(THD *thd, Item *arg1, Item *arg2)
Create_func_encrypt Create_func_encrypt::s_singleton;
Item*
-Create_func_encrypt::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_encrypt::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3335,7 +3396,7 @@ Create_func_exp::create_1_arg(THD *thd, Item *arg1)
Create_func_export_set Create_func_export_set::s_singleton;
Item*
-Create_func_export_set::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_export_set::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3388,7 +3449,7 @@ Create_func_export_set::create_native(THD *thd, LEX_CSTRING *name,
Create_func_field Create_func_field::s_singleton;
Item*
-Create_func_field::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_field::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -3427,7 +3488,7 @@ Create_func_floor::create_1_arg(THD *thd, Item *arg1)
Create_func_format Create_func_format::s_singleton;
Item*
-Create_func_format::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_format::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3492,7 +3553,7 @@ Create_func_from_days::create_1_arg(THD *thd, Item *arg1)
Create_func_from_unixtime Create_func_from_unixtime::s_singleton;
Item*
-Create_func_from_unixtime::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_from_unixtime::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3542,7 +3603,7 @@ Create_func_get_lock::create_2_arg(THD *thd, Item *arg1, Item *arg2)
Create_func_greatest Create_func_greatest::s_singleton;
Item*
-Create_func_greatest::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_greatest::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -3650,8 +3711,8 @@ Create_func_json_exists::create_2_arg(THD *thd, Item *arg1, Item *arg2)
Create_func_json_detailed Create_func_json_detailed::s_singleton;
Item*
-Create_func_json_detailed::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_json_detailed::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
@@ -3777,7 +3838,7 @@ Create_func_last_day::create_1_arg(THD *thd, Item *arg1)
Create_func_json_array Create_func_json_array::s_singleton;
Item*
-Create_func_json_array::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_array::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func;
@@ -3799,8 +3860,8 @@ Create_func_json_array::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_array_append Create_func_json_array_append::s_singleton;
Item*
-Create_func_json_array_append::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_json_array_append::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
@@ -3825,8 +3886,8 @@ Create_func_json_array_append::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_array_insert Create_func_json_array_insert::s_singleton;
Item*
-Create_func_json_array_insert::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_json_array_insert::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
@@ -3851,8 +3912,8 @@ Create_func_json_array_insert::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_insert Create_func_json_insert::s_singleton;
Item*
-Create_func_json_insert::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_json_insert::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
@@ -3878,7 +3939,7 @@ Create_func_json_insert::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_set Create_func_json_set::s_singleton;
Item*
-Create_func_json_set::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_set::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3905,7 +3966,7 @@ Create_func_json_set::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_replace Create_func_json_replace::s_singleton;
Item*
-Create_func_json_replace::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_replace::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3932,7 +3993,7 @@ Create_func_json_replace::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_remove Create_func_json_remove::s_singleton;
Item*
-Create_func_json_remove::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_remove::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3958,7 +4019,7 @@ Create_func_json_remove::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_object Create_func_json_object::s_singleton;
Item*
-Create_func_json_object::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_object::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func;
@@ -3991,7 +4052,7 @@ Create_func_json_object::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_length Create_func_json_length::s_singleton;
Item*
-Create_func_json_length::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_length::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func;
@@ -4016,7 +4077,7 @@ Create_func_json_length::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_merge Create_func_json_merge::s_singleton;
Item*
-Create_func_json_merge::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_merge::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func;
@@ -4041,8 +4102,8 @@ Create_func_json_merge::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_merge_patch Create_func_json_merge_patch::s_singleton;
Item*
-Create_func_json_merge_patch::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_json_merge_patch::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func;
int arg_count;
@@ -4065,7 +4126,7 @@ Create_func_json_merge_patch::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_contains Create_func_json_contains::s_singleton;
Item*
-Create_func_json_contains::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_contains::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4091,7 +4152,7 @@ Create_func_json_contains::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_keys Create_func_json_keys::s_singleton;
Item*
-Create_func_json_keys::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_keys::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4117,8 +4178,8 @@ Create_func_json_keys::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_contains_path Create_func_json_contains_path::s_singleton;
Item*
-Create_func_json_contains_path::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_json_contains_path::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
@@ -4143,8 +4204,8 @@ Create_func_json_contains_path::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_extract Create_func_json_extract::s_singleton;
Item*
-Create_func_json_extract::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_json_extract::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
@@ -4169,7 +4230,7 @@ Create_func_json_extract::create_native(THD *thd, LEX_CSTRING *name,
Create_func_json_search Create_func_json_search::s_singleton;
Item*
-Create_func_json_search::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_json_search::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4195,7 +4256,7 @@ Create_func_json_search::create_native(THD *thd, LEX_CSTRING *name,
Create_func_last_insert_id Create_func_last_insert_id::s_singleton;
Item*
-Create_func_last_insert_id::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_last_insert_id::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4241,7 +4302,7 @@ Create_func_lcase::create_1_arg(THD *thd, Item *arg1)
Create_func_least Create_func_least::s_singleton;
Item*
-Create_func_least::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_least::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -4323,7 +4384,7 @@ Create_func_load_file::create_1_arg(THD *thd, Item *arg1)
Create_func_locate Create_func_locate::s_singleton;
Item*
-Create_func_locate::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_locate::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4364,7 +4425,7 @@ Create_func_locate::create_native(THD *thd, LEX_CSTRING *name,
Create_func_log Create_func_log::s_singleton;
Item*
-Create_func_log::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_log::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4421,7 +4482,7 @@ Create_func_lpad Create_func_lpad::s_singleton;
Create_func_lpad_oracle Create_func_lpad_oracle::s_singleton;
Item*
-Create_func_lpad::create_native_std(THD *thd, LEX_CSTRING *name,
+Create_func_lpad::create_native_std(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4453,7 +4514,7 @@ Create_func_lpad::create_native_std(THD *thd, LEX_CSTRING *name,
Item*
-Create_func_lpad::create_native_oracle(THD *thd, LEX_CSTRING *name,
+Create_func_lpad::create_native_oracle(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= item_list ? item_list->elements : 0;
@@ -4519,7 +4580,7 @@ Create_func_maketime::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
Create_func_make_set Create_func_make_set::s_singleton;
Item*
-Create_func_make_set::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_make_set::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -4540,7 +4601,7 @@ Create_func_make_set::create_native(THD *thd, LEX_CSTRING *name,
Create_func_master_pos_wait Create_func_master_pos_wait::s_singleton;
Item*
-Create_func_master_pos_wait::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_master_pos_wait::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
@@ -4591,7 +4652,7 @@ Create_func_master_pos_wait::create_native(THD *thd, LEX_CSTRING *name,
Create_func_master_gtid_wait Create_func_master_gtid_wait::s_singleton;
Item*
-Create_func_master_gtid_wait::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_master_gtid_wait::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4795,7 +4856,7 @@ Create_func_radians::create_1_arg(THD *thd, Item *arg1)
Create_func_rand Create_func_rand::s_singleton;
Item*
-Create_func_rand::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_rand::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4886,7 +4947,7 @@ Create_func_reverse::create_1_arg(THD *thd, Item *arg1)
Create_func_round Create_func_round::s_singleton;
Item*
-Create_func_round::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_round::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4926,7 +4987,7 @@ Create_func_rpad Create_func_rpad::s_singleton;
Create_func_rpad_oracle Create_func_rpad_oracle::s_singleton;
Item*
-Create_func_rpad::create_native_std(THD *thd, LEX_CSTRING *name,
+Create_func_rpad::create_native_std(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -4958,7 +5019,7 @@ Create_func_rpad::create_native_std(THD *thd, LEX_CSTRING *name,
Item*
-Create_func_rpad::create_native_oracle(THD *thd, LEX_CSTRING *name,
+Create_func_rpad::create_native_oracle(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= item_list ? item_list->elements : 0;
@@ -5014,8 +5075,8 @@ Create_func_sec_to_time::create_1_arg(THD *thd, Item *arg1)
Create_func_sformat Create_func_sformat::s_singleton;
Item*
-Create_func_sformat::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_sformat::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
int arg_count= 0;
@@ -5136,8 +5197,8 @@ Create_func_substr_index::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *a
Create_func_substr_oracle Create_func_substr_oracle::s_singleton;
Item*
-Create_func_substr_oracle::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_substr_oracle::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= item_list ? item_list->elements : 0;
@@ -5224,7 +5285,7 @@ Create_func_to_base64::create_1_arg(THD *thd, Item *arg1)
Create_func_to_char Create_func_to_char::s_singleton;
Item*
-Create_func_to_char::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_to_char::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -5316,7 +5377,7 @@ Create_func_unhex::create_1_arg(THD *thd, Item *arg1)
Create_func_unix_timestamp Create_func_unix_timestamp::s_singleton;
Item*
-Create_func_unix_timestamp::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_unix_timestamp::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -5422,8 +5483,8 @@ Create_func_wsrep_sync_wait_upto::s_singleton;
Item*
Create_func_wsrep_sync_wait_upto::create_native(THD *thd,
- LEX_CSTRING *name,
- List<Item> *item_list)
+ const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
@@ -5473,7 +5534,7 @@ Create_func_xml_update::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg
Create_func_year_week Create_func_year_week::s_singleton;
Item*
-Create_func_year_week::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_year_week::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
diff --git a/sql/item_create.h b/sql/item_create.h
index c04adad469c..89769f76254 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
- Copyright (c) 2008-2011 Monty Program Ab
+ Copyright (c) 2008, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -58,7 +58,8 @@ public:
@param item_list The list of arguments to the function, can be NULL
@return An item representing the parsed function call, or NULL
*/
- virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) = 0;
+ virtual Item *create_func(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list) = 0;
protected:
/** Constructor */
@@ -75,8 +76,8 @@ protected:
class Create_func_arg0 : public Create_func
{
public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list);
+ Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
/**
Builder method, with no arguments.
@@ -100,7 +101,8 @@ protected:
class Create_func_arg1 : public Create_func
{
public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
/**
Builder method, with one argument.
@@ -125,7 +127,8 @@ protected:
class Create_func_arg2 : public Create_func
{
public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
/**
Builder method, with two arguments.
@@ -151,7 +154,8 @@ protected:
class Create_func_arg3 : public Create_func
{
public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
/**
Builder method, with three arguments.
@@ -184,8 +188,8 @@ protected:
class Create_native_func : public Create_func
{
public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list);
+ Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
/**
Builder method, with no arguments.
@@ -194,7 +198,7 @@ public:
@param item_list The function parameters, none of which are named
@return An item representing the function call
*/
- virtual Item *create_native(THD *thd, LEX_CSTRING *name,
+ virtual Item *create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list) = 0;
protected:
@@ -222,8 +226,8 @@ public:
@param item_list The list of arguments to the function, can be NULL
@return An item representing the parsed function call
*/
- virtual Item *create_func(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list);
+ Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
/**
The builder create method, for qualified functions.
@@ -234,7 +238,9 @@ public:
@param item_list The list of arguments to the function, can be NULL
@return An item representing the parsed function call
*/
- virtual Item *create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name,
+ virtual Item *create_with_db(THD *thd,
+ const LEX_CSTRING *db,
+ const LEX_CSTRING *name,
bool use_explicit_name,
List<Item> *item_list) = 0;
@@ -272,8 +278,8 @@ extern Create_qfunc * find_qualified_function_builder(THD *thd);
class Create_udf_func : public Create_func
{
public:
- virtual Item *create_func(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list);
+ Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
/**
The builder create method, for User Defined Functions.
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 49b85e2213b..7a1115425d9 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
- Copyright (c) 2011, 2021, MariaDB
+ Copyright (c) 2011, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2989,19 +2989,19 @@ protected:
class Create_func_distance_sphere: public Create_native_func
{
- public:
- Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
- override;
- static Create_func_distance_sphere s_singleton;
+public:
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
+ static Create_func_distance_sphere s_singleton;
- protected:
- Create_func_distance_sphere() {}
- virtual ~Create_func_distance_sphere() {}
+protected:
+ Create_func_distance_sphere() {}
+ virtual ~Create_func_distance_sphere() {}
};
Item*
-Create_func_distance_sphere::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_distance_sphere::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
int arg_count= 0;
@@ -3121,7 +3121,8 @@ protected:
class Create_func_geometry_from_text : public Create_native_func
{
public:
- Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
static Create_func_geometry_from_text s_singleton;
@@ -3132,7 +3133,8 @@ protected:
Item*
-Create_func_geometry_from_text::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_geometry_from_text::create_native(THD *thd,
+ const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3170,7 +3172,8 @@ Create_func_geometry_from_text::create_native(THD *thd, LEX_CSTRING *name,
class Create_func_geometry_from_wkb : public Create_native_func
{
public:
- Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
static Create_func_geometry_from_wkb s_singleton;
@@ -3181,7 +3184,7 @@ protected:
Item*
-Create_func_geometry_from_wkb::create_native(THD *thd, LEX_CSTRING *name,
+Create_func_geometry_from_wkb::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
Item *func= NULL;
@@ -3219,7 +3222,8 @@ Create_func_geometry_from_wkb::create_native(THD *thd, LEX_CSTRING *name,
class Create_func_geometry_from_json : public Create_native_func
{
public:
- Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
static Create_func_geometry_from_json s_singleton;
@@ -3230,8 +3234,9 @@ protected:
Item*
-Create_func_geometry_from_json::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_geometry_from_json::create_native(THD *thd,
+ const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
@@ -3277,7 +3282,8 @@ Create_func_geometry_from_json::create_native(THD *thd, LEX_CSTRING *name,
class Create_func_as_geojson : public Create_native_func
{
public:
- Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list);
+ Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list)
+ override;
static Create_func_as_geojson s_singleton;
@@ -3288,8 +3294,8 @@ protected:
Item*
-Create_func_as_geojson::create_native(THD *thd, LEX_CSTRING *name,
- List<Item> *item_list)
+Create_func_as_geojson::create_native(THD *thd, const LEX_CSTRING *name,
+ List<Item> *item_list)
{
Item *func= NULL;
int arg_count= 0;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 453ce5be4e0..4f1e19037b0 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -5499,9 +5499,10 @@ ER_TRG_DOES_NOT_EXIST
hindi "TRIGGER मौजूद नहीं है"
spa "El disparador no existe"
ER_TRG_ON_VIEW_OR_TEMP_TABLE
- eng "Trigger's '%-.192s' is view or temporary table"
- ger "'%-.192s' des Triggers ist View oder temporäre Tabelle"
- spa "El disparador '%-.192s' es una vista o tabla temporal"
+ eng "Trigger's '%-.192s' is a view, temporary table or sequence"
+ ger "'%-.192s' des Triggers ist ein View, temporäre Tabelle oder Sequence"
+ spa "El disparador '%-.192s' es una vista, tabla temporal o secuencia"
+ hindi "Trigger का '%-.192s' एक व्यू, टेम्पररी टेबल या सीक्वेंस है"
ER_TRG_CANT_CHANGE_ROW
eng "Updating of %s row is not allowed in %strigger"
ger "Aktualisieren einer %s-Zeile ist in einem %s-Trigger nicht erlaubt"
@@ -8574,8 +8575,8 @@ ER_SEQUENCE_RUN_OUT
eng "Sequence '%-.64s.%-.64s' has run out"
spa "La secuencia '%-.64s.%-.64s' se ha agotado"
ER_SEQUENCE_INVALID_DATA
- eng "Sequence '%-.64s.%-.64s' values are conflicting"
- spa "Los valores de secuencia '%-.64s.%-.64s' son conflictivos"
+ eng "Sequence '%-.64s.%-.64s' has out of range value for options"
+ spa "La secuencia '%-.64s.%-.64s' tiene un valor fuera de rango para las opciones"
ER_SEQUENCE_INVALID_TABLE_STRUCTURE
eng "Sequence '%-.64s.%-.64s' table structure is invalid (%s)"
spa "La estuctura de tabla de secuencia '%-.64s.%-.64s' es inválida (%s)"
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 9c3dc5bbb78..a28a423d20a 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -9264,18 +9264,18 @@ bool LEX::call_statement_start(THD *thd,
(static_cast<const LEX_CSTRING*>(db)))))
{
my_error(ER_WRONG_DB_NAME, MYF(0), db->str);
- return NULL;
+ return true;
}
if (check_routine_name(pkg) ||
check_routine_name(proc))
- return NULL;
+ return true;
// Concat `pkg` and `name` to `pkg.name`
LEX_CSTRING pkg_dot_proc;
if (q_pkg_proc.make_qname(thd->mem_root, &pkg_dot_proc) ||
check_ident_length(&pkg_dot_proc) ||
!(spname= new (thd->mem_root) sp_name(db, &pkg_dot_proc, true)))
- return NULL;
+ return true;
sp_handler_package_function.add_used_routine(thd->lex, thd, spname);
sp_handler_package_body.add_used_routine(thd->lex, thd, &q_db_pkg);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 1ea44a28f1d..6b9310791da 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2021, MariaDB
+ Copyright (c) 2008, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -9201,6 +9201,7 @@ THD *find_thread_by_id(longlong id, bool query_id)
return arg.thd;
}
+
/**
kill one thread.
@@ -9216,7 +9217,7 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
THD *tmp;
uint error= (type == KILL_TYPE_QUERY ? ER_NO_SUCH_QUERY : ER_NO_SUCH_THREAD);
DBUG_ENTER("kill_one_thread");
- DBUG_PRINT("enter", ("id: %lld signal: %u", id, (uint) kill_signal));
+ DBUG_PRINT("enter", ("id: %lld signal: %d", id, kill_signal));
tmp= find_thread_by_id(id, type == KILL_TYPE_QUERY);
if (!tmp)
DBUG_RETURN(error);
@@ -9244,7 +9245,8 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
faster and do a harder kill than KILL_SYSTEM_THREAD;
*/
- mysql_mutex_lock(&tmp->LOCK_thd_data); // for various wsrep* checks below
+ mysql_mutex_lock(&tmp->LOCK_thd_data); // Lock from concurrent usage
+
#ifdef WITH_WSREP
if (((thd->security_ctx->master_access & PRIV_KILL_OTHER_USER_PROCESS) ||
thd->security_ctx->user_matches(tmp->security_ctx)) &&
@@ -9259,27 +9261,28 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
if (tmp->wsrep_aborter && tmp->wsrep_aborter != thd->thread_id)
{
/* victim is in hit list already, bail out */
- WSREP_DEBUG("victim has wsrep aborter: %lu, skipping awake()",
- tmp->wsrep_aborter);
+ WSREP_DEBUG("victim %lld has wsrep aborter: %lu, skipping awake()",
+ id, tmp->wsrep_aborter);
error= 0;
}
else
#endif /* WITH_WSREP */
{
- WSREP_DEBUG("kill_one_thread %llu, victim: %llu wsrep_aborter %llu by signal %d",
- thd->thread_id, id, tmp->wsrep_aborter, kill_signal);
+ WSREP_DEBUG("kill_one_thread victim: %lld wsrep_aborter %lu"
+ " by signal %d",
+ id, tmp->wsrep_aborter, kill_signal);
tmp->awake_no_mutex(kill_signal);
- WSREP_DEBUG("victim: %llu taken care of", id);
error= 0;
}
}
else
error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR :
ER_KILL_DENIED_ERROR);
+
mysql_mutex_unlock(&tmp->LOCK_thd_data);
}
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
- DBUG_PRINT("exit", ("%d", error));
+ DBUG_PRINT("exit", ("%u", error));
DBUG_RETURN(error);
}
@@ -9390,6 +9393,18 @@ static
void sql_kill(THD *thd, longlong id, killed_state state, killed_type type)
{
uint error;
+#ifdef WITH_WSREP
+ if (WSREP(thd))
+ {
+ WSREP_DEBUG("sql_kill called");
+ if (thd->wsrep_applier)
+ {
+ WSREP_DEBUG("KILL in applying, bailing out here");
+ return;
+ }
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
+ }
+#endif /* WITH_WSREP */
if (likely(!(error= kill_one_thread(thd, id, state, type))))
{
if (!thd->killed)
@@ -9399,6 +9414,11 @@ void sql_kill(THD *thd, longlong id, killed_state state, killed_type type)
}
else
my_error(error, MYF(0), id);
+#ifdef WITH_WSREP
+ return;
+ wsrep_error_label:
+ my_error(ER_KILL_DENIED_ERROR, MYF(0), (long long) thd->thread_id);
+#endif /* WITH_WSREP */
}
@@ -9407,6 +9427,18 @@ sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
{
uint error;
ha_rows rows;
+#ifdef WITH_WSREP
+ if (WSREP(thd))
+ {
+ WSREP_DEBUG("sql_kill_user called");
+ if (thd->wsrep_applier)
+ {
+ WSREP_DEBUG("KILL in applying, bailing out here");
+ return;
+ }
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
+ }
+#endif /* WITH_WSREP */
switch (error= kill_threads_for_user(thd, user, state, &rows))
{
case 0:
@@ -9419,6 +9451,11 @@ sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
default:
my_error(error, MYF(0));
}
+#ifdef WITH_WSREP
+ return;
+ wsrep_error_label:
+ my_error(ER_KILL_DENIED_ERROR, MYF(0), (long long) thd->thread_id);
+#endif /* WITH_WSREP */
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 7d381dd3d18..521f6a5630b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -27794,8 +27794,11 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
if (unit->is_unit_op() || unit->fake_select_lex)
{
+ ulonglong save_options= 0;
+
if (unit->union_needs_tmp_table() && unit->fake_select_lex)
{
+ save_options= unit->fake_select_lex->options;
unit->fake_select_lex->select_number= FAKE_SELECT_LEX_ID; // just for initialization
unit->fake_select_lex->type= unit_operation_text[unit->common_op()];
unit->fake_select_lex->options|= SELECT_DESCRIBE;
@@ -27806,6 +27809,9 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
if (!is_pushed_union)
res= unit->exec();
}
+
+ if (unit->union_needs_tmp_table() && unit->fake_select_lex)
+ unit->fake_select_lex->options= save_options;
}
else
{
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc
index 91ee97f7822..7ef30641888 100644
--- a/sql/sql_sequence.cc
+++ b/sql/sql_sequence.cc
@@ -122,7 +122,7 @@ bool sequence_definition::check_and_adjust(bool set_reserved_until)
start >= min_value &&
max_value != LONGLONG_MAX &&
min_value != LONGLONG_MIN &&
- cache < (LONGLONG_MAX - max_increment) / max_increment &&
+ cache >= 0 && cache < (LONGLONG_MAX - max_increment) / max_increment &&
((real_increment > 0 && reserved_until >= min_value) ||
(real_increment < 0 && reserved_until <= max_value)))
DBUG_RETURN(FALSE);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index ab84d1fa58f..4293805c26e 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3328,16 +3328,6 @@ static my_bool processlist_callback(THD *tmp, processlist_callback_arg *arg)
arg->table->field[11]->store((double) tmp->progress.counter /
(double) max_counter*100.0);
}
- else
- {
- /*
- This is a DECIMAL column without DEFAULT.
- restore_record() fills its Field::ptr to zero bytes,
- according to pack_length(). But an array of zero bytes
- is not a valid decimal. Set it explicitly to 0.
- */
- arg->table->field[11]->store((longlong) 0, true);
- }
mysql_mutex_unlock(&tmp->LOCK_thd_data);
}
@@ -8652,6 +8642,7 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables)
if (bitmap_is_set(table->read_set, i))
{
field->move_field(cur);
+ field->reset();
*to_recinfo++= *from_recinfo;
cur+= from_recinfo->length;
}
@@ -8673,6 +8664,7 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables)
to_recinfo->type= FIELD_NORMAL;
to_recinfo++;
}
+ store_record(table, s->default_values);
p->recinfo= to_recinfo;
// TODO switch from Aria to Memory if all blobs were optimized away?
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index cce426b842f..6685b91b02e 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2004, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2021, MariaDB
+ Copyright (c) 2010, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -439,6 +439,8 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
Query_tables_list backup;
DDL_LOG_STATE ddl_log_state, ddl_log_state_tmp_file;
char trn_path_buff[FN_REFLEN];
+ char path[FN_REFLEN + 1];
+
DBUG_ENTER("mysql_create_or_drop_trigger");
/* Charset of the buffer for statement must be system one. */
@@ -568,8 +570,12 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
/* We should have only one table in table list. */
DBUG_ASSERT(tables->next_global == 0);
- /* We do not allow creation of triggers on temporary tables. */
- if (create && thd->find_tmp_table_share(tables))
+ build_table_filename(path, sizeof(path) - 1, tables->db.str, tables->alias.str, ".frm", 0);
+ tables->required_type= dd_frm_type(NULL, path, NULL, NULL, NULL);
+
+ /* We do not allow creation of triggers on temporary tables or sequence. */
+ if (tables->required_type == TABLE_TYPE_SEQUENCE ||
+ (create && thd->find_tmp_table_share(tables)))
{
my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias.str);
goto end;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 13a891d8622..998baffec43 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2679,7 +2679,7 @@ sequence_def:
if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE))
{
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
- YYABORT;
+ MYSQL_YYABORT;
}
if (unlikely(Lex->create_info.seq_create_info->used_fields &
seq_field_used_restart))
@@ -2691,7 +2691,7 @@ sequence_def:
if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE))
{
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
- YYABORT;
+ MYSQL_YYABORT;
}
if (unlikely(Lex->create_info.seq_create_info->used_fields &
seq_field_used_restart))
@@ -8664,7 +8664,7 @@ subselect:
query_expression
{
if (!($$= Lex->parsed_subselect($1)))
- YYABORT;
+ MYSQL_YYABORT;
}
;
@@ -8709,14 +8709,14 @@ subquery:
else
$1->fake_select_lex->braces= false;
if (!($$= Lex->parsed_subselect($1)))
- YYABORT;
+ MYSQL_YYABORT;
}
| '(' with_clause query_expression_no_with_clause ')'
{
$3->set_with_clause($2);
$2->attach_to($3->first_select());
if (!($$= Lex->parsed_subselect($3)))
- YYABORT;
+ MYSQL_YYABORT;
}
;
diff --git a/sql/table.cc b/sql/table.cc
index 1e1a99b83af..3476d13c456 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2660,8 +2660,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (flags & VERS_SYSTEM_FIELD)
{
- switch (handler->real_field_type())
- {
+ auto field_type= handler->real_field_type();
+
+ DBUG_EXECUTE_IF("error_vers_wrong_type", field_type= MYSQL_TYPE_BLOB;);
+
+ switch (field_type) {
case MYSQL_TYPE_TIMESTAMP2:
break;
case MYSQL_TYPE_LONGLONG:
@@ -2672,9 +2675,13 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
}
/* Fallthrough */
default:
- my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), fieldnames.type_names[i],
- versioned == VERS_TIMESTAMP ? "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED",
- table_name.str);
+ my_error(ER_VERS_FIELD_WRONG_TYPE,
+ (field_type == MYSQL_TYPE_LONGLONG ?
+ MYF(0) : MYF(ME_WARNING)),
+ fieldnames.type_names[i],
+ (versioned == VERS_TIMESTAMP ?
+ "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED"),
+ table_name.str);
goto err;
}
}
@@ -8981,9 +8988,6 @@ bool TABLE::check_period_overlaps(const KEY &key,
void TABLE::vers_update_fields()
{
- bitmap_set_bit(write_set, vers_start_field()->field_index);
- bitmap_set_bit(write_set, vers_end_field()->field_index);
-
if (!vers_write)
{
file->column_bitmaps_signal();
@@ -8992,17 +8996,21 @@ void TABLE::vers_update_fields()
if (versioned(VERS_TIMESTAMP))
{
+ bitmap_set_bit(write_set, vers_start_field()->field_index);
if (vers_start_field()->store_timestamp(in_use->query_start(),
in_use->query_start_sec_part()))
{
DBUG_ASSERT(0);
}
vers_start_field()->set_has_explicit_value();
+ bitmap_set_bit(read_set, vers_start_field()->field_index);
}
+ bitmap_set_bit(write_set, vers_end_field()->field_index);
vers_end_field()->set_max();
vers_end_field()->set_has_explicit_value();
bitmap_set_bit(read_set, vers_end_field()->field_index);
+
file->column_bitmaps_signal();
if (vfield)
update_virtual_fields(file, VCOL_UPDATE_FOR_READ);
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index fd2f6d592f4..d805b4c64eb 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -1,4 +1,5 @@
/* Copyright 2008-2022 Codership Oy <http://www.codership.com>
+ Copyright (c) 2008, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1501,44 +1502,14 @@ static int run_sql_command(THD *thd, const char *query)
if (thd->is_error())
{
int const err= thd->get_stmt_da()->sql_errno();
- WSREP_WARN ("Error executing '%s': %d (%s)%s",
- query, err, thd->get_stmt_da()->message(),
- err == ER_UNKNOWN_SYSTEM_VARIABLE ?
- ". Was mysqld built with --with-innodb-disallow-writes ?" : "");
+ WSREP_WARN ("Error executing '%s': %d (%s)",
+ query, err, thd->get_stmt_da()->message());
thd->clear_error();
return -1;
}
return 0;
}
-static void sst_disallow_writes (THD* thd, bool yes)
-{
- char query_str[64]= { 0, };
- ssize_t const query_max= sizeof(query_str) - 1;
- CHARSET_INFO *current_charset;
-
- current_charset= thd->variables.character_set_client;
-
- if (!is_supported_parser_charset(current_charset))
- {
- /* Do not use non-supported parser character sets */
- WSREP_WARN("Current client character set is non-supported parser character set: %s", current_charset->cs_name.str);
- thd->variables.character_set_client= &my_charset_latin1;
- WSREP_WARN("For SST temporally setting character set to : %s",
- my_charset_latin1.cs_name.str);
- }
-
- snprintf (query_str, query_max, "SET GLOBAL innodb_disallow_writes=%d",
- yes ? 1 : 0);
-
- if (run_sql_command(thd, query_str))
- {
- WSREP_ERROR("Failed to disallow InnoDB writes");
- }
- thd->variables.character_set_client= current_charset;
-}
-
-
static int sst_flush_tables(THD* thd)
{
WSREP_INFO("Flushing tables for SST...");
@@ -1598,16 +1569,11 @@ static int sst_flush_tables(THD* thd)
}
else
{
- WSREP_INFO("Tables flushed.");
+ ha_disable_internal_writes(true);
- /* disable further disk IO */
- sst_disallow_writes(thd, true);
- WSREP_INFO("Disabled further disk IO.");
+ WSREP_INFO("Tables flushed.");
- /*
- Tables have been flushed. Create a file with cluster state ID and
- wsrep_gtid_domain_id.
- */
+ // Create a file with cluster state ID and wsrep_gtid_domain_id.
char content[100];
snprintf(content, sizeof(content), "%s:%lld %d\n", wsrep_cluster_state_uuid,
(long long)wsrep_locked_seqno, wsrep_gtid_server.domain_id);
@@ -1650,6 +1616,8 @@ static int sst_flush_tables(THD* thd)
}
free(real_name);
free(tmp_name);
+ if (err)
+ ha_disable_internal_writes(false);
}
return err;
@@ -1700,31 +1668,30 @@ wait_signal:
if (!strcasecmp (out, magic_flush))
{
err= sst_flush_tables (thd.ptr);
+
if (!err)
{
- /*
+ locked= true;
+ /*
Lets also keep statements that modify binary logs (like RESET LOGS,
RESET MASTER) from proceeding until the files have been transferred
to the joiner node.
*/
if (mysql_bin_log.is_open())
- {
mysql_mutex_lock(mysql_bin_log.get_log_lock());
- }
-
- locked= true;
- WSREP_INFO("Donor state reached");
+ WSREP_INFO("Donor state reached");
DBUG_EXECUTE_IF("sync.wsrep_donor_state",
- {
- const char act[]=
- "now "
- "SIGNAL sync.wsrep_donor_state_reached "
- "WAIT_FOR signal.wsrep_donor_state";
- assert(!debug_sync_set_action(thd.ptr,
- STRING_WITH_LEN(act)));
- };);
+ {
+ const char act[]=
+ "now "
+ "SIGNAL sync.wsrep_donor_state_reached "
+ "WAIT_FOR signal.wsrep_donor_state";
+ assert(!debug_sync_set_action(thd.ptr,
+ STRING_WITH_LEN(act)));
+ };);
+
goto wait_signal;
}
}
@@ -1732,14 +1699,11 @@ wait_signal:
{
if (locked)
{
+ locked= false;
+ ha_disable_internal_writes(false);
if (mysql_bin_log.is_open())
- {
- mysql_mutex_assert_owner(mysql_bin_log.get_log_lock());
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
- }
- sst_disallow_writes (thd.ptr, false);
thd.ptr->global_read_lock.unlock_global_read_lock(thd.ptr);
- locked= false;
}
err= 0;
goto wait_signal;
@@ -1770,12 +1734,12 @@ wait_signal:
if (locked) // don't forget to unlock server before return
{
+ ha_disable_internal_writes(false);
if (mysql_bin_log.is_open())
{
mysql_mutex_assert_owner(mysql_bin_log.get_log_lock());
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
}
- sst_disallow_writes (thd.ptr, false);
thd.ptr->global_read_lock.unlock_global_read_lock(thd.ptr);
}