Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3

This commit is contained in:
Alexander Barkov 2017-04-20 08:49:48 +04:00
commit ef6e03d38d
26 changed files with 217 additions and 229 deletions

View file

@ -1351,7 +1351,7 @@ CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;
END ;|
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.f' already exists
CREATE TRIGGER f1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;

View file

@ -274,7 +274,7 @@ DROP TRIGGER tr1;
CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=20;
CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=21;
Warnings:
Note 1359 Trigger already exists
Note 1359 Trigger 'test.tr1' already exists
DROP TRIGGER IF EXISTS tr1;
DROP TRIGGER IF EXISTS tr1;
Warnings:

View file

@ -10,7 +10,7 @@ SELECT @sum;
CREATE TRIGGER IF NOT EXISTS val_sum_new BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val;
CREATE TRIGGER IF NOT EXISTS val_sum AFTER INSERT ON t1 FOR EACH ROW SET @sum = @sum + 1 + NEW.val;
Warnings:
Note 1359 Trigger already exists
Note 1359 Trigger 'db1.val_' already exists
CREATE OR REPLACE TRIGGER IF NOT EXISTS val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 2 + NEW.val;
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
@ -21,7 +21,7 @@ SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val
ACTION_STATEMENT
SET @sum = @sum + 3 + NEW.val
CREATE TRIGGER val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 4 + NEW.val;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'db1.val_' already exists
SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
ACTION_STATEMENT
SET @sum = @sum + 3 + NEW.val

View file

@ -703,7 +703,7 @@ ERROR 42S21: Duplicate column name 'f1'
with t as (select * from t2 where c>3),
t as (select a from t1 where a>2)
select * from t,t1 where t1.a=t.c;
ERROR HY000: Duplicate query name in WITH clause
ERROR HY000: Duplicate query name `t` in WITH clause
with t as (select a from s where a<5),
s as (select a from t1 where b>='d')
select * from t,s where t.a=s.a;

View file

@ -301,11 +301,11 @@ create trigger trg before insert on t2 for each row set @a:=1;
ERROR 42S02: Table 'test.t2' doesn't exist
create trigger trg before insert on t1 for each row set @a:=1;
create trigger trg after insert on t1 for each row set @a:=1;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
create trigger trg2 before insert on t1 for each row set @a:=1;
drop trigger trg2;
create trigger trg before insert on t3 for each row set @a:=1;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
create trigger trg2 before insert on t3 for each row set @a:=1;
drop trigger trg2;
drop trigger trg;
@ -1986,7 +1986,7 @@ drop table if exists t1;
create table t1 (i int, j int);
create trigger t1_bi before insert on t1 for each row begin end;
create trigger t1_bi before insert on t1 for each row begin end;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.t1_' already exists
create trigger t1_bi2 before insert on t1 for each row begin end;
drop trigger t1_bi;
drop trigger t1_bi2;

View file

@ -2268,12 +2268,32 @@ create table t1 (s1 int);
create view abc as select * from t1 as abc;
drop table t1;
drop view abc;
flush status;
create table t1(f1 char(1));
create view v1 as select * from t1;
select * from (select f1 as f2 from v1) v where v.f2='a';
f2
select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a';
f2 f3
show status like "Created_tmp%";
Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_files 0
Created_tmp_tables 0
drop view v1;
drop table t1;
set @tmp=@@optimizer_switch;
set @@optimizer_switch='derived_merge=OFF';
create table t1(f1 char(1));
create view v1 as select * from t1;
select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a';
f2 f3
show status like "Created_tmp%";
Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_files 0
Created_tmp_tables 1
drop view v1;
drop table t1;
set @@optimizer_switch=@tmp;
create view v1 as SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
select * from v1;
CONVERT_TZ('2004-01-01 12:00:00','GMT','MET')

View file

@ -58,3 +58,20 @@ View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select lastval("test"."s1") AS "a" latin1 latin1_swedish_ci
DROP VIEW v1;
DROP SEQUENCE s1;
#
# MDEV-12533 sql_mode=ORACLE: Add support for database qualified sequence names in NEXTVAL and CURRVAL
#
CREATE SEQUENCE s1;
SELECT test.s1.nextval;
test.s1.nextval
1
SELECT test.s1.currval;
test.s1.currval
1
SELECT .s1.nextval;
.s1.nextval
2
SELECT .s1.currval;
.s1.currval
2
DROP SEQUENCE s1;

View file

@ -31,3 +31,13 @@ SELECT * FROM v1;
SHOW CREATE VIEW v1;
DROP VIEW v1;
DROP SEQUENCE s1;
--echo #
--echo # MDEV-12533 sql_mode=ORACLE: Add support for database qualified sequence names in NEXTVAL and CURRVAL
--echo #
CREATE SEQUENCE s1;
SELECT test.s1.nextval;
SELECT test.s1.currval;
SELECT .s1.nextval;
SELECT .s1.currval;
DROP SEQUENCE s1;

View file

@ -253,7 +253,7 @@ Testcase 3.5.1.10:
------------------
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
drop trigger trg7_1;
Testcase 3.5.1.?:
@ -266,7 +266,7 @@ create trigger trig before insert on t1
for each row set new.f1 ='trig t1';
create trigger trig before update on t2
for each row set new.f1 ='trig t2';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.tri' already exists
insert into t1 value ('insert to t1',1);
select * from t1;
f1 f2

View file

@ -459,7 +459,7 @@ Create trigger trg_3_406010_2 AFTER DELETE
on tb3 for each row set @test_var=@test_var+50;
Create trigger trg_3_406010_1 AFTER INSERT
on tb3 for each row set @test_var=@test_var+1;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
select @test_var;
@test_var
1

View file

@ -254,7 +254,7 @@ Testcase 3.5.1.10:
------------------
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
drop trigger trg7_1;
Testcase 3.5.1.?:
@ -267,7 +267,7 @@ create trigger trig before insert on t1
for each row set new.f1 ='trig t1';
create trigger trig before update on t2
for each row set new.f1 ='trig t2';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.tri' already exists
insert into t1 value ('insert to t1',1);
select * from t1;
f1 f2

View file

@ -459,7 +459,7 @@ Create trigger trg_3_406010_2 AFTER DELETE
on tb3 for each row set @test_var=@test_var+50;
Create trigger trg_3_406010_1 AFTER INSERT
on tb3 for each row set @test_var=@test_var+1;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
select @test_var;
@test_var
1

View file

@ -254,7 +254,7 @@ Testcase 3.5.1.10:
------------------
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
drop trigger trg7_1;
Testcase 3.5.1.?:
@ -267,7 +267,7 @@ create trigger trig before insert on t1
for each row set new.f1 ='trig t1';
create trigger trig before update on t2
for each row set new.f1 ='trig t2';
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.tri' already exists
insert into t1 value ('insert to t1',1);
select * from t1;
f1 f2

View file

@ -459,7 +459,7 @@ Create trigger trg_3_406010_2 AFTER DELETE
on tb3 for each row set @test_var=@test_var+50;
Create trigger trg_3_406010_1 AFTER INSERT
on tb3 for each row set @test_var=@test_var+1;
ERROR HY000: Trigger already exists
ERROR HY000: Trigger 'test.trg' already exists
select @test_var;
@test_var
1

View file

@ -19,7 +19,7 @@ SET @sum = @sum + NEW.val + 1
connection master;
CREATE TRIGGER IF NOT EXISTS val_sum AFTER INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val + 2;
Warnings:
Note 1359 Trigger already exists
Note 1359 Trigger 'db1.val_' already exists
SELECT ACTION_STATEMENT AS ACTION_STATEMENT_Master FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
ACTION_STATEMENT_Master
SET @sum = @sum + NEW.val + 1

View file

@ -2124,12 +2124,24 @@ drop view abc;
#
# Bug#12993 View column rename broken in subselect
#
flush status;
create table t1(f1 char(1));
create view v1 as select * from t1;
select * from (select f1 as f2 from v1) v where v.f2='a';
select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a';
show status like "Created_tmp%";
drop view v1;
drop table t1;
set @tmp=@@optimizer_switch;
set @@optimizer_switch='derived_merge=OFF';
create table t1(f1 char(1));
create view v1 as select * from t1;
select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a';
show status like "Created_tmp%";
drop view v1;
drop table t1;
set @@optimizer_switch=@tmp;
#
# Bug#11416 Server crash if using a view that uses function convert_tz

View file

@ -1117,21 +1117,6 @@ void Item::set_name_no_truncate(THD *thd, const char *str, uint length,
}
void Item::set_name_for_rollback(THD *thd, const char *str, uint length,
CHARSET_INFO *cs)
{
char *old_name, *new_name;
old_name= name;
set_name(thd, str, length, cs);
new_name= name;
if (old_name != new_name)
{
name= old_name;
thd->change_item_tree((Item **) &name, (Item *) new_name);
}
}
/**
@details
This function is called when:

View file

@ -645,8 +645,6 @@ public:
void set_name(THD *thd, const char *str, uint length, CHARSET_INFO *cs);
void set_name_no_truncate(THD *thd, const char *str, uint length,
CHARSET_INFO *cs);
void set_name_for_rollback(THD *thd, const char *str, uint length,
CHARSET_INFO *cs);
void rename(char *new_name);
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
virtual void cleanup();

View file

@ -5257,8 +5257,8 @@ ER_SP_GOTO_IN_HNDLR
eng "GOTO is not allowed in a stored procedure handler"
ger "GOTO ist im Handler einer gespeicherten Prozedur nicht erlaubt"
ER_TRG_ALREADY_EXISTS
eng "Trigger already exists"
ger "Trigger existiert bereits"
eng "Trigger '%s' already exists"
ger "Trigger '%s' existiert bereits"
ER_TRG_DOES_NOT_EXIST
eng "Trigger does not exist"
ger "Trigger existiert nicht"
@ -6471,7 +6471,7 @@ ER_CANNOT_LOAD_FROM_TABLE_V2
ger "Kann %s.%s nicht einlesen. Tabelle ist wahrscheinlich beschädigt"
ER_MASTER_DELAY_VALUE_OUT_OF_RANGE
eng "The requested value %u for the master delay exceeds the maximum %u"
eng "The requested value %lu for the master delay exceeds the maximum %lu"
ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT
eng "Only Format_description_log_event and row events are allowed in BINLOG statements (but %s was provided)"
@ -7351,7 +7351,7 @@ ER_WITH_COL_WRONG_LIST
ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE
eng "Too many WITH elements in WITH clause"
ER_DUP_QUERY_NAME
eng "Duplicate query name in WITH clause"
eng "Duplicate query name %`-.64s in WITH clause"
ER_RECURSIVE_WITHOUT_ANCHORS
eng "No anchors for recursive WITH element '%s'"
ER_UNACCEPTABLE_MUTUAL_RECURSION

View file

@ -5268,27 +5268,10 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
*ref != NULL means that *ref contains the item that we need to
replace. If the item was aliased by the user, set the alias to
the replacing item.
We need to set alias on both ref itself and on ref real item.
*/
if (*ref && !(*ref)->is_autogenerated_name)
{
if (register_tree_change)
{
item->set_name_for_rollback(thd, (*ref)->name,
(*ref)->name_length,
system_charset_info);
item->real_item()->set_name_for_rollback(thd, (*ref)->name,
(*ref)->name_length,
system_charset_info);
}
else
{
item->set_name(thd, (*ref)->name, (*ref)->name_length,
system_charset_info);
item->real_item()->set_name(thd, (*ref)->name, (*ref)->name_length,
system_charset_info);
}
}
item->set_name(thd, (*ref)->name, (*ref)->name_length,
system_charset_info);
if (register_tree_change)
thd->change_item_tree(ref, item);
else

View file

@ -6387,6 +6387,53 @@ my_var *LEX::create_outvar(THD *thd,
}
Item *LEX::create_item_func_nextval(THD *thd, Table_ident *table_ident)
{
TABLE_LIST *table;
if (!(table= current_select->add_table_to_list(thd, table_ident, 0,
TL_OPTION_SEQUENCE,
TL_WRITE_ALLOW_WRITE,
MDL_SHARED_WRITE)))
return NULL;
return new (thd->mem_root) Item_func_nextval(thd, table);
}
Item *LEX::create_item_func_lastval(THD *thd, Table_ident *table_ident)
{
TABLE_LIST *table;
if (!(table= current_select->add_table_to_list(thd, table_ident, 0,
TL_OPTION_SEQUENCE,
TL_READ,
MDL_SHARED_READ)))
return NULL;
return new (thd->mem_root) Item_func_lastval(thd, table);
}
Item *LEX::create_item_func_nextval(THD *thd,
const LEX_STRING &db,
const LEX_STRING &name)
{
Table_ident *table_ident;
if (!(table_ident= new (thd->mem_root) Table_ident(thd, db, name, false)))
return NULL;
return create_item_func_nextval(thd, table_ident);
}
Item *LEX::create_item_func_lastval(THD *thd,
const LEX_STRING &db,
const LEX_STRING &name)
{
Table_ident *table_ident;
if (!(table_ident= new (thd->mem_root) Table_ident(thd, db, name, false)))
return NULL;
return create_item_func_lastval(thd, table_ident);
}
Item *LEX::create_item_ident(THD *thd,
const LEX_STRING &a,
const LEX_STRING &b,
@ -6401,37 +6448,50 @@ Item *LEX::create_item_ident(THD *thd,
if (!my_strnncoll(system_charset_info,
(const uchar *) b.str, 7,
(const uchar *) "NEXTVAL", 7))
{
TABLE_LIST *table;
Table_ident *table_ident;
if (!(table_ident= new (thd->mem_root) Table_ident(a)) ||
!(table= current_select->add_table_to_list(thd, table_ident, 0,
TL_OPTION_SEQUENCE,
TL_WRITE_ALLOW_WRITE,
MDL_SHARED_WRITE)))
return NULL;
return new (thd->mem_root) Item_func_nextval(thd, table);
}
return create_item_func_nextval(thd, null_lex_str, a);
else if (!my_strnncoll(system_charset_info,
(const uchar *) b.str, 7,
(const uchar *) "CURRVAL", 7))
{
TABLE_LIST *table;
Table_ident *table_ident;
if (!(table_ident= new (thd->mem_root) Table_ident(a)) ||
!(table= current_select->add_table_to_list(thd, table_ident, 0,
TL_OPTION_SEQUENCE,
TL_READ,
MDL_SHARED_READ)))
return NULL;
return new (thd->mem_root) Item_func_lastval(thd, table);
}
return create_item_func_lastval(thd, null_lex_str, a);
}
return create_item_ident_nospvar(thd, a, b);
}
Item *LEX::create_item_ident(THD *thd,
const LEX_STRING &a,
const LEX_STRING &b,
const LEX_STRING &c)
{
const char *schema= (thd->client_capabilities & CLIENT_NO_SCHEMA ?
NullS : a.str);
if ((thd->variables.sql_mode & MODE_ORACLE) && c.length == 7)
{
if (!my_strnncoll(system_charset_info,
(const uchar *) c.str, 7,
(const uchar *) "NEXTVAL", 7))
return create_item_func_nextval(thd, a, b);
else if (!my_strnncoll(system_charset_info,
(const uchar *) c.str, 7,
(const uchar *) "CURRVAL", 7))
return create_item_func_lastval(thd, a, b);
}
if (current_select->no_table_names_allowed)
{
my_error(ER_TABLENAME_NOT_ALLOWED_HERE, MYF(0), b.str, thd->where);
return NULL;
}
if (current_select->parsing_place != IN_HAVING ||
current_select->get_in_sum_expr() > 0)
return new (thd->mem_root) Item_field(thd, current_context(),
schema, b.str, c.str);
return new (thd->mem_root) Item_ref(thd, current_context(),
schema, b.str, c.str);
}
Item *LEX::create_item_limit(THD *thd,
const LEX_STRING &a,

View file

@ -3239,6 +3239,35 @@ public:
const LEX_STRING &a,
const LEX_STRING &b,
uint pos_in_q, uint length_in_q);
/*
Create an item from its qualified name.
Depending on context, it can be a table field, a table field reference,
or a sequence NEXTVAL and CURRVAL.
@param thd - THD, for mem_root
@param a - the first name
@param b - the second name
@param c - the third name
@retval - NULL on error, or a pointer to a new Item.
*/
Item *create_item_ident(THD *thd,
const LEX_STRING &a,
const LEX_STRING &b,
const LEX_STRING &c);
/*
Create an item for "NEXT VALUE FOR sequence_name"
*/
Item *create_item_func_nextval(THD *thd, Table_ident *ident);
Item *create_item_func_nextval(THD *thd, const LEX_STRING &db,
const LEX_STRING &name);
/*
Create an item for "PREVIOUS VALUE FOR sequence_name"
*/
Item *create_item_func_lastval(THD *thd, Table_ident *ident);
Item *create_item_func_lastval(THD *thd, const LEX_STRING &db,
const LEX_STRING &name);
/*
Create an item for a name in LIMIT clause: LIMIT var
@param THD - THD, for mem_root

View file

@ -833,6 +833,8 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
}
else if (lex->create_info.if_not_exists())
{
strxnmov(trigname_buff, sizeof(trigname_buff-1), tables->db, ".",
lex->spname->m_name.str, NullS);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_TRG_ALREADY_EXISTS,
ER_THD(thd, ER_TRG_ALREADY_EXISTS),
@ -850,7 +852,9 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
}
else
{
my_error(ER_TRG_ALREADY_EXISTS, MYF(0));
strxnmov(trigname_buff, sizeof(trigname_buff-1), tables->db, ".",
lex->spname->m_name.str, NullS);
my_error(ER_TRG_ALREADY_EXISTS, MYF(0), trigname_buff);
DBUG_RETURN(true);
}
}

View file

@ -2231,7 +2231,7 @@ master_def:
if ($3 > MASTER_DELAY_MAX)
{
my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0),
$3, MASTER_DELAY_MAX);
(ulong) $3, (ulong) MASTER_DELAY_MAX);
}
else
Lex->mi.sql_delay = $3;
@ -9354,46 +9354,22 @@ column_default_non_parenthesized_expr:
}
| NEXT_SYM VALUE_SYM FOR_SYM table_ident
{
TABLE_LIST *table;
if (!(table= Select->add_table_to_list(thd, $4, 0,
TL_OPTION_SEQUENCE,
TL_WRITE_ALLOW_WRITE,
MDL_SHARED_WRITE)))
MYSQL_YYABORT;
if (!($$= new (thd->mem_root) Item_func_nextval(thd, table)))
if (!($$= Lex->create_item_func_nextval(thd, $4)))
MYSQL_YYABORT;
}
| NEXTVAL_SYM '(' table_ident ')'
{
TABLE_LIST *table;
if (!(table= Select->add_table_to_list(thd, $3, 0,
TL_OPTION_SEQUENCE,
TL_WRITE_ALLOW_WRITE,
MDL_SHARED_WRITE)))
MYSQL_YYABORT;
if (!($$= new (thd->mem_root) Item_func_nextval(thd, table)))
if (!($$= Lex->create_item_func_nextval(thd, $3)))
MYSQL_YYABORT;
}
| PREVIOUS_SYM VALUE_SYM FOR_SYM table_ident
{
TABLE_LIST *table;
if (!(table= Select->add_table_to_list(thd, $4, 0,
TL_OPTION_SEQUENCE,
TL_READ,
MDL_SHARED_READ)))
MYSQL_YYABORT;
if (!($$= new (thd->mem_root) Item_func_lastval(thd, table)))
if (!($$= Lex->create_item_func_lastval(thd, $4)))
MYSQL_YYABORT;
}
| LASTVAL_SYM '(' table_ident ')'
{
TABLE_LIST *table;
if (!(table= Select->add_table_to_list(thd, $3, 0,
TL_OPTION_SEQUENCE,
TL_READ,
MDL_SHARED_WRITE)))
MYSQL_YYABORT;
if (!($$= new (thd->mem_root) Item_func_lastval(thd, table)))
if (!($$= Lex->create_item_func_lastval(thd, $3)))
MYSQL_YYABORT;
}
;
@ -14166,53 +14142,12 @@ simple_ident_q:
simple_ident_q2:
'.' ident '.' ident
{
LEX *lex= thd->lex;
SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed)
{
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
MYF(0), $2.str, thd->where);
}
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
$$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
NullS, $2.str, $4.str);
}
else
{
$$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
NullS, $2.str, $4.str);
}
if ($$ == NULL)
if (!($$= Lex->create_item_ident(thd, null_lex_str, $2, $4)))
MYSQL_YYABORT;
}
| ident '.' ident '.' ident
{
LEX *lex= thd->lex;
SELECT_LEX *sel= lex->current_select;
const char* schema= (thd->client_capabilities & CLIENT_NO_SCHEMA ?
NullS : $1.str);
if (sel->no_table_names_allowed)
{
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
MYF(0), $3.str, thd->where);
}
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
$$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
schema,
$3.str, $5.str);
}
else
{
$$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
schema,
$3.str, $5.str);
}
if ($$ == NULL)
if (!($$= Lex->create_item_ident(thd, $1, $3, $5)))
MYSQL_YYABORT;
}
;

View file

@ -1685,7 +1685,7 @@ master_def:
if ($3 > MASTER_DELAY_MAX)
{
my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0),
$3, MASTER_DELAY_MAX);
(ulong) $3, (ulong) MASTER_DELAY_MAX);
}
else
Lex->mi.sql_delay = $3;
@ -9442,46 +9442,22 @@ column_default_non_parenthesized_expr:
}
| NEXT_SYM VALUE_SYM FOR_SYM table_ident
{
TABLE_LIST *table;
if (!(table= Select->add_table_to_list(thd, $4, 0,
TL_OPTION_SEQUENCE,
TL_WRITE_ALLOW_WRITE,
MDL_SHARED_WRITE)))
MYSQL_YYABORT;
if (!($$= new (thd->mem_root) Item_func_nextval(thd, table)))
if (!($$= Lex->create_item_func_nextval(thd, $4)))
MYSQL_YYABORT;
}
| NEXTVAL_SYM '(' table_ident ')'
{
TABLE_LIST *table;
if (!(table= Select->add_table_to_list(thd, $3, 0,
TL_OPTION_SEQUENCE,
TL_WRITE_ALLOW_WRITE,
MDL_SHARED_WRITE)))
MYSQL_YYABORT;
if (!($$= new (thd->mem_root) Item_func_nextval(thd, table)))
if (!($$= Lex->create_item_func_nextval(thd, $3)))
MYSQL_YYABORT;
}
| PREVIOUS_SYM VALUE_SYM FOR_SYM table_ident
{
TABLE_LIST *table;
if (!(table= Select->add_table_to_list(thd, $4, 0,
TL_OPTION_SEQUENCE,
TL_READ,
MDL_SHARED_READ)))
MYSQL_YYABORT;
if (!($$= new (thd->mem_root) Item_func_lastval(thd, table)))
if (!($$= Lex->create_item_func_lastval(thd, $4)))
MYSQL_YYABORT;
}
| LASTVAL_SYM '(' table_ident ')'
{
TABLE_LIST *table;
if (!(table= Select->add_table_to_list(thd, $3, 0,
TL_OPTION_SEQUENCE,
TL_READ,
MDL_SHARED_WRITE)))
MYSQL_YYABORT;
if (!($$= new (thd->mem_root) Item_func_lastval(thd, table)))
if (!($$= Lex->create_item_func_lastval(thd, $3)))
MYSQL_YYABORT;
}
;
@ -14320,53 +14296,12 @@ simple_ident_q2:
}
| '.' ident '.' ident
{
LEX *lex= thd->lex;
SELECT_LEX *sel= lex->current_select;
if (sel->no_table_names_allowed)
{
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
MYF(0), $2.str, thd->where);
}
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
$$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
NullS, $2.str, $4.str);
}
else
{
$$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
NullS, $2.str, $4.str);
}
if ($$ == NULL)
if (!($$= Lex->create_item_ident(thd, null_lex_str, $2, $4)))
MYSQL_YYABORT;
}
| ident '.' ident '.' ident
{
LEX *lex= thd->lex;
SELECT_LEX *sel= lex->current_select;
const char* schema= (thd->client_capabilities & CLIENT_NO_SCHEMA ?
NullS : $1.str);
if (sel->no_table_names_allowed)
{
my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
MYF(0), $3.str, thd->where);
}
if ((sel->parsing_place != IN_HAVING) ||
(sel->get_in_sum_expr() > 0))
{
$$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
schema,
$3.str, $5.str);
}
else
{
$$= new (thd->mem_root) Item_ref(thd, Lex->current_context(),
schema,
$3.str, $5.str);
}
if ($$ == NULL)
if (!($$= Lex->create_item_ident(thd, $1, $3, $5)))
MYSQL_YYABORT;
}
;

View file

@ -2171,7 +2171,7 @@ int ha_cassandra::info(uint flag)
}
void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
uint key_length, bool with_zerofill);