summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/func_test.result9
-rw-r--r--mysql-test/r/grant.result20
-rw-r--r--mysql-test/r/group_by.result11
-rw-r--r--mysql-test/r/lowercase_table.result3
-rw-r--r--mysql-test/r/multi_update.result9
-rw-r--r--mysql-test/t/func_test.test7
-rw-r--r--mysql-test/t/grant.test10
-rw-r--r--mysql-test/t/group_by.test2
-rw-r--r--mysql-test/t/lowercase_table.test1
-rw-r--r--mysql-test/t/multi_update.test7
-rw-r--r--sql/item_cmpfunc.cc1
-rw-r--r--sql/item_func.h1
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/sql_acl.cc2
-rw-r--r--sql/sql_class.h12
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/sql_update.cc6
-rw-r--r--sql/sql_yacc.yy4
19 files changed, 109 insertions, 6 deletions
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index e1c27daa9a7..e11eaa0d246 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -60,3 +60,12 @@ select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
select 1 and 0 or 2, 2 or 1 and 0;
1 and 0 or 2 2 or 1 and 0
1 1
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) TYPE=MyISAM;
+INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
+CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) TYPE=MyISAM;
+INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
+SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
+rank rank rank
+2 2 NULL
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 4ce22e84dd5..6ed5445233c 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -100,6 +100,26 @@ GRANT SELECT, REFERENCES, REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localh
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
table_priv column_priv
Select,References References
+grant all on test.* to user1@localhost with grant option;
+revoke all on test.* from user1@localhost;
+show grants for user1@localhost;
+Grants for user1@localhost
+GRANT USAGE ON *.* TO 'user1'@'localhost'
+GRANT USAGE ON `test`.* TO 'user1'@'localhost' WITH GRANT OPTION
+revoke grant option on test.* from user1@localhost;
+show grants for user1@localhost;
+Grants for user1@localhost
+GRANT USAGE ON *.* TO 'user1'@'localhost'
+grant all on test.t1 to user2@localhost with grant option;
+revoke all on test.t1 from user2@localhost;
+show grants for user2@localhost;
+Grants for user2@localhost
+GRANT USAGE ON *.* TO 'user2'@'localhost'
+GRANT USAGE ON `test`.`t1` TO 'user2'@'localhost' WITH GRANT OPTION
+revoke grant option on test.t1 from user2@localhost;
+show grants for user2@localhost;
+Grants for user2@localhost
+GRANT USAGE ON *.* TO 'user2'@'localhost'
delete from mysql.user where user='mysqltest_1';
delete from mysql.db where user='mysqltest_1';
delete from mysql.tables_priv where user='mysqltest_1';
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 67e6bec09f6..f89cb8a6792 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -585,4 +585,15 @@ select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(q
id sqty cqty
1 5 2
2 9 2
+select count(*), case interval(qty,2,3,4,5,6,7,8) when -1 then NULL when 0 then "zero" when 1 then "one" when 2 then "two" end as category from t1 group by category;
+count(*) category
+2 NULL
+1 one
+1 two
+select count(*), interval(qty,2,3,4,5,6,7,8) as category from t1 group by category;
+count(*) category
+1 1
+1 2
+1 3
+1 4
drop table t1;
diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result
index d32228216b8..c884e5de0f0 100644
--- a/mysql-test/r/lowercase_table.result
+++ b/mysql-test/r/lowercase_table.result
@@ -21,7 +21,8 @@ select count(*) from t1;
count(*)
0
select count(T1.a) from t1;
-Unknown table 'T1' in field list
+count(T1.a)
+0
select count(bags.a) from t1 as Bags;
Unknown table 'bags' in field list
drop table t1;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 91170f885a3..350cea420b6 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -318,3 +318,12 @@ create table t2(Z varchar(15));
insert into t2(Z) select concat(a.a,b.a,c.a,d.a) from t1 as a, t1 as b, t1 as c, t1 as d;
update t2,t3 set Z =param_scenario_costs;
drop table t1,t2,t3;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,1),(2,1),(3,1);
+insert into t2 values (1,1), (3,1);
+update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL;
+select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL;
+a b a b
+2 2 NULL NULL
+drop table t1,t2;
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index 700fab97f5e..e03d0dd0f0f 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -30,3 +30,10 @@ drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
select 1 and 0 or 2, 2 or 1 and 0;
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) TYPE=MyISAM;
+INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
+CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) TYPE=MyISAM;
+INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
+SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 4433c9cbffc..9b670b36f2c 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -66,6 +66,16 @@ REVOKE insert,insert (a) on t1 from mysqltest_1@localhost;
GRANT references on t1 to mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+grant all on test.* to user1@localhost with grant option;
+revoke all on test.* from user1@localhost;
+show grants for user1@localhost;
+revoke grant option on test.* from user1@localhost;
+show grants for user1@localhost;
+grant all on test.t1 to user2@localhost with grant option;
+revoke all on test.t1 from user2@localhost;
+show grants for user2@localhost;
+revoke grant option on test.t1 from user2@localhost;
+show grants for user2@localhost;
delete from mysql.user where user='mysqltest_1';
delete from mysql.db where user='mysqltest_1';
delete from mysql.tables_priv where user='mysqltest_1';
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 67f4eb580a6..df99bc2a9dc 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -420,4 +420,6 @@ select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(q
select id, sum(qty) as sqty from t1 group by id having sqty>2 and count(qty)>1;
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sqty>2 and cqty>1;
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and count(qty)>1;
+select count(*), case interval(qty,2,3,4,5,6,7,8) when -1 then NULL when 0 then "zero" when 1 then "one" when 2 then "two" end as category from t1 group by category;
+select count(*), interval(qty,2,3,4,5,6,7,8) as category from t1 group by category;
drop table t1;
diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test
index b3453dfd3c4..397cc26e127 100644
--- a/mysql-test/t/lowercase_table.test
+++ b/mysql-test/t/lowercase_table.test
@@ -18,7 +18,6 @@ drop table t3;
create table t1 (a int);
select count(*) from T1;
select count(*) from t1;
---error 1109
select count(T1.a) from t1;
--error 1109
select count(bags.a) from t1 as Bags;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 0c7ad6160ee..7aa4e74cec0 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -260,3 +260,10 @@ create table t2(Z varchar(15));
insert into t2(Z) select concat(a.a,b.a,c.a,d.a) from t1 as a, t1 as b, t1 as c, t1 as d;
update t2,t3 set Z =param_scenario_costs;
drop table t1,t2,t3;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,1),(2,1),(3,1);
+insert into t2 values (1,1), (3,1);
+update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL;
+select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL;
+drop table t1,t2;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 7415fc5b98e..04c27de63eb 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -295,6 +295,7 @@ void Item_func_interval::fix_length_and_dec()
used_tables_cache|= item->used_tables();
not_null_tables_cache&= item->not_null_tables();
with_sum_func= with_sum_func || item->with_sum_func;
+ const_item_cache&=item->const_item();
}
diff --git a/sql/item_func.h b/sql/item_func.h
index 8a4cace0b87..bccd0ca7adb 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -514,6 +514,7 @@ public:
void fix_length_and_dec();
enum Item_result result_type () const { return cmp_type; }
unsigned int size_of() { return sizeof(*this);}
+ table_map not_null_tables() const { return 0; }
};
class Item_func_min :public Item_func_min_max
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index e31038d7fee..64510280c79 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -863,3 +863,9 @@ inline void mark_as_null_row(TABLE *table)
table->status|=STATUS_NULL_ROW;
bfill(table->null_flags,table->null_bytes,255);
}
+
+inline void table_case_convert(char * name, uint length)
+{
+ if (lower_case_table_names)
+ casedn(name, length);
+}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 83cd2c7d2b4..9f3068fce85 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -3089,6 +3089,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (test_all_bits(table_access, (TABLE_ACLS & ~GRANT_ACL)))
global.append("ALL PRIVILEGES",14);
+ else if (!(table_access & ~GRANT_ACL))
+ global.append("USAGE",5);
else
{
int found= 0;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index b30faa3e9d9..9bf4dc852d7 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -33,7 +33,7 @@ enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_IGNORE };
enum enum_log_type { LOG_CLOSED, LOG_TO_BE_OPENED, LOG_NORMAL, LOG_NEW, LOG_BIN};
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
DELAY_KEY_WRITE_ALL };
-
+extern inline void table_case_convert(char * name, uint length);
/* log info errors */
#define LOG_INFO_EOF -1
#define LOG_INFO_IO -2
@@ -756,7 +756,6 @@ typedef struct st_sort_buffer {
SORT_FIELD *sortorder;
} SORT_BUFFER;
-
/* Structure for db & table in sql_yacc */
class Table_ident :public Sql_alloc {
@@ -770,8 +769,15 @@ class Table_ident :public Sql_alloc {
db.str=0;
else
db= db_arg;
+ if (db.str)
+ table_case_convert(db.str,db.length);
+ table_case_convert(table.str,table.length);
+ }
+ inline Table_ident(LEX_STRING table_arg) :table(table_arg)
+ {
+ db.str=0;
+ table_case_convert(table.str,table.length);
}
- inline Table_ident(LEX_STRING table_arg) :table(table_arg) {db.str=0;}
inline void change_db(char *db_name)
{ db.str= db_name; db.length=(uint) strlen(db_name); }
};
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 548714345f8..6686f927e05 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3396,8 +3396,10 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
}
ptr->alias= alias_str;
+#ifdef TO_BE_DELETED
if (lower_case_table_names)
casedn_str(table->table.str);
+#endif
ptr->real_name=table->table.str;
ptr->real_name_length=table->table.length;
ptr->lock_type= lock_type;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c55015f7aa5..16fe3e0db5a 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1460,8 +1460,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
strmov(new_name_buff,new_name);
fn_same(new_name_buff,table_name,3);
+#ifdef TO_BE_DELETED
if (lower_case_table_names)
casedn_str(new_name);
+#endif
if ((lower_case_table_names &&
!my_strcasecmp(new_name_buff,table_name)) ||
(!lower_case_table_names &&
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 3179c8e0f24..2f3f917a962 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -575,6 +575,7 @@ multi_update::initialize_tables(JOIN *join)
{
TABLE *table=table_ref->table;
uint cnt= table_ref->shared;
+ Item_field *If;
List<Item> temp_fields= *fields_for_table[cnt];
ORDER group;
@@ -598,7 +599,10 @@ multi_update::initialize_tables(JOIN *join)
/* ok to be on stack as this is not referenced outside of this func */
Field_string offset(table->file->ref_length, 0, "offset",
table, 1);
- if (temp_fields.push_front(new Item_field(((Field *) &offset))))
+ if (!(If=new Item_field(((Field *) &offset))))
+ DBUG_RETURN(1);
+ If->maybe_null=0;
+ if (temp_fields.push_front(If))
DBUG_RETURN(1);
/* Make an unique key over the first field to avoid duplicated updates */
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 03837300904..32c5bd11be9 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -3221,16 +3221,20 @@ simple_ident:
| ident '.' ident
{
SELECT_LEX *sel=Select;
+ table_case_convert($1.str, $1.length);
$$ = !sel->create_refs || sel->in_sum_expr > 0 ? (Item*) new Item_field(NullS,$1.str,$3.str) : (Item*) new Item_ref(NullS,$1.str,$3.str);
}
| '.' ident '.' ident
{
SELECT_LEX *sel=Select;
+ table_case_convert($2.str,$2.length);
$$ = !sel->create_refs || sel->in_sum_expr > 0 ? (Item*) new Item_field(NullS,$2.str,$4.str) : (Item*) new Item_ref(NullS,$2.str,$4.str);
}
| ident '.' ident '.' ident
{
SELECT_LEX *sel=Select;
+ table_case_convert($1.str,$1.length);
+ table_case_convert($3.str,$3.length);
$$ = !sel->create_refs || sel->in_sum_expr > 0 ? (Item*) new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str);
};