summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-02-15 11:48:30 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-02-15 11:48:30 +0200
commitcc3b5d1fe75cf1d9b83b7918151f8d90e9263d34 (patch)
tree126aa92625cbe953175cefec87dbd92d97ce7a54 /sql
parentb006d2ead4640f0ab4e29687fd7d24988b1c98f1 (diff)
parent22770a9f9a7fb4c30dbdc204e5a8f829303b7373 (diff)
downloadmariadb-git-cc3b5d1fe75cf1d9b83b7918151f8d90e9263d34.tar.gz
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc24
-rw-r--r--sql/handler.cc6
-rw-r--r--sql/item.cc14
-rw-r--r--sql/item.h7
-rw-r--r--sql/item_cmpfunc.h24
-rw-r--r--sql/item_func.cc8
-rw-r--r--sql/opt_range.cc2
-rw-r--r--sql/sql_acl.cc5
-rw-r--r--sql/sql_load.cc22
-rw-r--r--sql/sql_time.cc43
-rw-r--r--sql/sql_time.h4
-rw-r--r--sql/sql_type.h2
-rw-r--r--sql/sql_yacc.yy35
-rw-r--r--sql/sql_yacc_ora.yy35
-rw-r--r--sql/wsrep_var.cc5
15 files changed, 162 insertions, 74 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 7c88f230734..1f97e587eb3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5819,7 +5819,10 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days)
long daydiff= calc_daynr(ltime->year, ltime->month, ltime->day) - days;
ltime->year= ltime->month= 0;
if (daydiff >=0 )
+ {
ltime->day= daydiff;
+ ltime->time_type= MYSQL_TIMESTAMP_TIME;
+ }
else
{
longlong timediff= ((((daydiff * 24LL +
@@ -5827,16 +5830,8 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days)
ltime->minute) * 60LL +
ltime->second) * 1000000LL +
ltime->second_part);
- unpack_time(timediff, ltime);
- /*
- unpack_time() broke down hours into ltime members hour,day,month.
- Mix them back to ltime->hour using the same factors
- that pack_time()/unpack_time() use (i.e. 32 for month).
- */
- ltime->hour+= (ltime->month * 32 + ltime->day) * 24;
- ltime->month= ltime->day= 0;
+ unpack_time(timediff, ltime, MYSQL_TIMESTAMP_TIME);
}
- ltime->time_type= MYSQL_TIMESTAMP_TIME;
}
@@ -6167,14 +6162,7 @@ bool Field_time_hires::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
packed= sec_part_unshift(packed - zero_point, dec);
- unpack_time(packed, ltime);
- /*
- unpack_time() returns MYSQL_TIMESTAMP_DATETIME.
- To get MYSQL_TIMESTAMP_TIME we need few adjustments
- */
- ltime->time_type= MYSQL_TIMESTAMP_TIME;
- ltime->hour+= (ltime->month*32+ltime->day)*24;
- ltime->month= ltime->day= 0;
+ unpack_time(packed, ltime, MYSQL_TIMESTAMP_TIME);
return false;
}
@@ -6837,7 +6825,7 @@ bool Field_datetime_hires::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
{
ASSERT_COLUMN_MARKED_FOR_READ;
ulonglong packed= read_bigendian(pos, Field_datetime_hires::pack_length());
- unpack_time(sec_part_unshift(packed, dec), ltime);
+ unpack_time(sec_part_unshift(packed, dec), ltime, MYSQL_TIMESTAMP_DATETIME);
return validate_MMDD(packed, ltime->month, ltime->day, fuzzydate);
}
diff --git a/sql/handler.cc b/sql/handler.cc
index 0534a701b73..06abd149aa5 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, 2016, MariaDB
+ Copyright (c) 2009, 2018, 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
@@ -798,7 +798,9 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
*/
void ha_close_connection(THD* thd)
{
- plugin_foreach(thd, closecon_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0);
+ plugin_foreach_with_mask(thd, closecon_handlerton,
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ PLUGIN_IS_DELETED|PLUGIN_IS_READY, 0);
}
static my_bool kill_handlerton(THD *thd, plugin_ref plugin,
diff --git a/sql/item.cc b/sql/item.cc
index 34db1a80dcd..85a71f5bb59 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -7002,9 +7002,9 @@ Item *Item_int::clone_item(THD *thd)
}
-void Item_datetime::set(longlong packed)
+void Item_datetime::set(longlong packed, enum_mysql_timestamp_type ts_type)
{
- unpack_time(packed, &ltime);
+ unpack_time(packed, &ltime, ts_type);
}
int Item_datetime::save_in_field(Field *field, bool no_conversions)
@@ -10079,13 +10079,7 @@ bool Item_cache_temporal::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
return 1;
}
- unpack_time(value, ltime);
- ltime->time_type= mysql_timestamp_type();
- if (ltime->time_type == MYSQL_TIMESTAMP_TIME)
- {
- ltime->hour+= (ltime->month*32+ltime->day)*24;
- ltime->month= ltime->day= 0;
- }
+ unpack_time(value, ltime, mysql_timestamp_type());
return 0;
}
@@ -10130,7 +10124,7 @@ Item *Item_cache_temporal::convert_to_basic_const_item(THD *thd)
else
{
MYSQL_TIME ltime;
- unpack_time(val_datetime_packed(), &ltime);
+ unpack_time(val_datetime_packed(), &ltime, MYSQL_TIMESTAMP_DATETIME);
new_item= (Item*) new (thd->mem_root) Item_datetime_literal(thd, &ltime,
decimals);
}
diff --git a/sql/item.h b/sql/item.h
index 7572b7cece2..648ff39d54a 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3600,7 +3600,12 @@ public:
int save_in_field(Field *field, bool no_conversions);
longlong val_int();
double val_real() { return (double)val_int(); }
- void set(longlong packed);
+ void set(longlong packed, enum_mysql_timestamp_type ts_type);
+ bool get_date(MYSQL_TIME *to, ulonglong fuzzydate)
+ {
+ *to= ltime;
+ return false;
+ }
};
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 44d1063fd57..4d0ee5cf993 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1321,7 +1321,7 @@ public:
{
return MY_TEST(compare(collation, base + pos1 * size, base + pos2 * size));
}
- virtual Item_result result_type()= 0;
+ virtual const Type_handler *type_handler() const= 0;
};
class in_string :public in_vector
@@ -1352,7 +1352,7 @@ public:
Item_string_for_in_vector *to= (Item_string_for_in_vector*) item;
to->set_value(str);
}
- Item_result result_type() { return STRING_RESULT; }
+ const Type_handler *type_handler() const { return &type_handler_varchar; }
};
class in_longlong :public in_vector
@@ -1379,7 +1379,7 @@ public:
((Item_int*) item)->unsigned_flag= (bool)
((packed_longlong*) base)[pos].unsigned_flag;
}
- Item_result result_type() { return INT_RESULT; }
+ const Type_handler *type_handler() const { return &type_handler_longlong; }
friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b);
};
@@ -1405,9 +1405,11 @@ public:
void value_to_item(uint pos, Item *item)
{
packed_longlong *val= reinterpret_cast<packed_longlong*>(base)+pos;
- Item_datetime *dt= reinterpret_cast<Item_datetime*>(item);
- dt->set(val->val);
+ Item_datetime *dt= static_cast<Item_datetime*>(item);
+ dt->set(val->val, type_handler()->mysql_timestamp_type());
}
+ uchar *get_value(Item *item)
+ { return get_value_internal(item, type_handler()->field_type()); }
friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b);
};
@@ -1419,8 +1421,7 @@ public:
:in_temporal(thd, elements)
{}
void set(uint pos,Item *item);
- uchar *get_value(Item *item)
- { return get_value_internal(item, MYSQL_TYPE_DATETIME); }
+ const Type_handler *type_handler() const { return &type_handler_datetime2; }
};
@@ -1431,8 +1432,7 @@ public:
:in_temporal(thd, elements)
{}
void set(uint pos,Item *item);
- uchar *get_value(Item *item)
- { return get_value_internal(item, MYSQL_TYPE_TIME); }
+ const Type_handler *type_handler() const { return &type_handler_time2; }
};
@@ -1448,7 +1448,7 @@ public:
{
((Item_float*)item)->value= ((double*) base)[pos];
}
- Item_result result_type() { return REAL_RESULT; }
+ const Type_handler *type_handler() const { return &type_handler_double; }
};
@@ -1466,7 +1466,7 @@ public:
Item_decimal *item_dec= (Item_decimal*)item;
item_dec->set_decimal_value(dec);
}
- Item_result result_type() { return DECIMAL_RESULT; }
+ const Type_handler *type_handler() const { return &type_handler_newdecimal; }
};
@@ -2439,7 +2439,7 @@ public:
void set(uint pos,Item *item);
uchar *get_value(Item *item);
friend class Item_func_in;
- Item_result result_type() { return ROW_RESULT; }
+ const Type_handler *type_handler() const { return &type_handler_row; }
cmp_item *get_cmp_item() { return &tmp; }
};
diff --git a/sql/item_func.cc b/sql/item_func.cc
index f2dabf74060..1b9b0e801bc 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2714,13 +2714,7 @@ bool Item_func_min_max::get_date_native(MYSQL_TIME *ltime, ulonglong fuzzy_date)
if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0)
min_max= res;
}
- unpack_time(min_max, ltime);
-
- if (Item_func_min_max::field_type() == MYSQL_TYPE_DATE)
- {
- ltime->time_type= MYSQL_TIMESTAMP_DATE;
- ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
- }
+ unpack_time(min_max, ltime, mysql_timestamp_type());
if (!(fuzzy_date & TIME_TIME_ONLY) &&
((null_value= check_date_with_warn(ltime, fuzzy_date,
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 77bf64f991a..b24411c5733 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7064,7 +7064,7 @@ SEL_TREE *Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM *param,
if (negated)
{
- if (array && array->result_type() != ROW_RESULT)
+ if (array && array->type_handler()->result_type() != ROW_RESULT)
{
/*
We get here for conditions in form "t.key NOT IN (c1, c2, ...)",
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index b1faed6aa36..96ed36da755 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -7476,13 +7476,12 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
ulong orig_want_access= original_want_access;
/*
- If sequence is used as part of NEXT VALUE, PREVIUS VALUE or SELECT,
+ If sequence is used as part of NEXT VALUE, PREVIOUS VALUE or SELECT,
we need to modify the requested access rights depending on how the
sequence is used.
*/
if (t_ref->sequence &&
- (bool)(orig_want_access &
- (SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL)))
+ !(want_access & ~(SELECT_ACL | INSERT_ACL | UPDATE_ACL | DELETE_ACL)))
{
/*
We want to have either SELECT or INSERT rights to sequences depending
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 17e2aca79e4..c0ee0057016 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -104,23 +104,25 @@ the transaction after every 10,000 inserted rows. */
static bool wsrep_load_data_split(THD *thd, const TABLE *table,
const COPY_INFO &info)
{
- extern struct handlerton* innodb_hton_ptr;
-
DBUG_ENTER("wsrep_load_data_split");
- if (wsrep_load_data_splitting && wsrep_on(thd)
- && info.records && !(info.records % 10000)
- && thd->transaction.stmt.ha_list
- && thd->transaction.stmt.ha_list->ht() == binlog_hton
- && thd->transaction.stmt.ha_list->next()
- && thd->transaction.stmt.ha_list->next()->ht() == innodb_hton_ptr
- && !thd->transaction.stmt.ha_list->next()->next())
+ if (!wsrep_load_data_splitting || !wsrep_on(thd)
+ || !info.records || (info.records % 10000)
+ || !thd->transaction.stmt.ha_list
+ || thd->transaction.stmt.ha_list->ht() != binlog_hton
+ || !thd->transaction.stmt.ha_list->next()
+ || thd->transaction.stmt.ha_list->next()->next())
+ DBUG_RETURN(false);
+
+ if (handlerton* hton= thd->transaction.stmt.ha_list->next()->ht())
{
+ if (hton->db_type != DB_TYPE_INNODB)
+ DBUG_RETURN(false);
WSREP_DEBUG("intermediate transaction commit in LOAD DATA");
if (wsrep_run_wsrep_commit(thd, true) != WSREP_TRX_OK) DBUG_RETURN(true);
if (binlog_hton->commit(binlog_hton, thd, true)) DBUG_RETURN(true);
wsrep_post_commit(thd, true);
- innodb_hton_ptr->commit(innodb_hton_ptr, thd, true);
+ hton->commit(hton, thd, true);
table->file->extra(HA_EXTRA_FAKE_START_STMT);
}
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 95435c698f8..b0de8dab4c5 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -1392,3 +1392,46 @@ bool datetime_to_time_with_warn(THD *thd, const MYSQL_TIME *dt,
int warnings= 0;
return check_time_range(tm, dec, &warnings);
}
+
+
+longlong pack_time(const MYSQL_TIME *my_time)
+{
+ return ((((((my_time->year * 13ULL +
+ my_time->month) * 32ULL +
+ my_time->day) * 24ULL +
+ my_time->hour) * 60ULL +
+ my_time->minute) * 60ULL +
+ my_time->second) * 1000000ULL +
+ my_time->second_part) * (my_time->neg ? -1 : 1);
+}
+
+#define get_one(WHERE, FACTOR) WHERE= (ulong)(packed % FACTOR); packed/= FACTOR
+
+void unpack_time(longlong packed, MYSQL_TIME *my_time,
+ enum_mysql_timestamp_type ts_type)
+{
+ if ((my_time->neg= packed < 0))
+ packed= -packed;
+ get_one(my_time->second_part, 1000000ULL);
+ get_one(my_time->second, 60U);
+ get_one(my_time->minute, 60U);
+ get_one(my_time->hour, 24U);
+ get_one(my_time->day, 32U);
+ get_one(my_time->month, 13U);
+ my_time->year= (uint)packed;
+ my_time->time_type= ts_type;
+ switch (ts_type) {
+ case MYSQL_TIMESTAMP_TIME:
+ my_time->hour+= (my_time->month * 32 + my_time->day) * 24;
+ my_time->month= my_time->day= 0;
+ break;
+ case MYSQL_TIMESTAMP_DATE:
+ my_time->hour= my_time->minute= my_time->second= my_time->second_part= 0;
+ break;
+ case MYSQL_TIMESTAMP_NONE:
+ case MYSQL_TIMESTAMP_ERROR:
+ DBUG_ASSERT(0);
+ case MYSQL_TIMESTAMP_DATETIME:
+ break;
+ }
+}
diff --git a/sql/sql_time.h b/sql/sql_time.h
index 94f24be3748..d7d04d77f0e 100644
--- a/sql/sql_time.h
+++ b/sql/sql_time.h
@@ -231,4 +231,8 @@ bool make_date_with_warn(MYSQL_TIME *ltime,
ulonglong fuzzy_date, timestamp_type ts_type);
bool adjust_time_range_with_warn(MYSQL_TIME *ltime, uint dec);
+longlong pack_time(const MYSQL_TIME *my_time);
+void unpack_time(longlong packed, MYSQL_TIME *my_time,
+ enum_mysql_timestamp_type ts_type);
+
#endif /* SQL_TIME_INCLUDED */
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 3c4ed054bb6..0446c93f88f 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -24,7 +24,7 @@
#include "mysqld.h"
#include "sql_array.h"
#include "sql_const.h"
-#include "my_time.h"
+#include "sql_time.h"
class Field;
class Column_definition;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index f7c69af45a2..c773c8da506 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2784,59 +2784,80 @@ sequence_def:
| NO_SYM MINVALUE_SYM
{
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
- MYSQL_YYABORT;
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
}
| NOMINVALUE_SYM
{
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
- MYSQL_YYABORT;
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
}
| MAXVALUE_SYM opt_equal longlong_num
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_max_value)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->max_value= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| NO_SYM MAXVALUE_SYM
{
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
- MYSQL_YYABORT;
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| NOMAXVALUE_SYM
{
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
- MYSQL_YYABORT;
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| START_SYM opt_with longlong_num
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_start)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "START"));
Lex->create_info.seq_create_info->start= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_start;
}
| INCREMENT_SYM opt_by longlong_num
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_increment)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "INCREMENT"));
Lex->create_info.seq_create_info->increment= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_increment;
}
| CACHE_SYM opt_equal longlong_num
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cache)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
Lex->create_info.seq_create_info->cache= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
}
| NOCACHE_SYM
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cache)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
Lex->create_info.seq_create_info->cache= 0;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
}
| CYCLE_SYM
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cycle)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
Lex->create_info.seq_create_info->cycle= 1;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
}
| NOCYCLE_SYM
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cycle)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
Lex->create_info.seq_create_info->cycle= 0;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
}
@@ -2847,6 +2868,9 @@ sequence_def:
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
YYABORT;
}
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_restart)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart;
}
| RESTART_SYM opt_with longlong_num
@@ -2856,6 +2880,9 @@ sequence_def:
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
YYABORT;
}
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_restart)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
Lex->create_info.seq_create_info->restart= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart | seq_field_used_restart_value;
}
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index dd84847387a..dda3b876953 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -2141,59 +2141,80 @@ sequence_def:
| NO_SYM MINVALUE_SYM
{
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
- MYSQL_YYABORT;
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
}
| NOMINVALUE_SYM
{
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
- MYSQL_YYABORT;
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
}
| MAXVALUE_SYM opt_equal longlong_num
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_max_value)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->max_value= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| NO_SYM MAXVALUE_SYM
{
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
- MYSQL_YYABORT;
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| NOMAXVALUE_SYM
{
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
- MYSQL_YYABORT;
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| START_SYM opt_with longlong_num
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_start)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "START"));
Lex->create_info.seq_create_info->start= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_start;
}
| INCREMENT_SYM opt_by longlong_num
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_increment)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "INCREMENT"));
Lex->create_info.seq_create_info->increment= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_increment;
}
| CACHE_SYM opt_equal longlong_num
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cache)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
Lex->create_info.seq_create_info->cache= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
}
| NOCACHE_SYM
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cache)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
Lex->create_info.seq_create_info->cache= 0;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
}
| CYCLE_SYM
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cycle)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
Lex->create_info.seq_create_info->cycle= 1;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
}
| NOCYCLE_SYM
{
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cycle)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
Lex->create_info.seq_create_info->cycle= 0;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
}
@@ -2204,6 +2225,9 @@ sequence_def:
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
YYABORT;
}
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_restart)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart;
}
| RESTART_SYM opt_with longlong_num
@@ -2213,6 +2237,9 @@ sequence_def:
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
YYABORT;
}
+ if (Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_restart)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
Lex->create_info.seq_create_info->restart= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart | seq_field_used_restart_value;
}
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index c54a5481187..ffa969a811c 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -42,7 +42,10 @@ int wsrep_init_vars()
return 0;
}
-extern ulong innodb_lock_schedule_algorithm;
+/* This is intentionally declared as a weak global symbol, so that
+linking will succeed even if the server is built with a dynamically
+linked InnoDB. */
+ulong innodb_lock_schedule_algorithm __attribute__((weak));
bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
{