summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorserg@serg.mysql.com <>2002-12-02 20:41:34 +0100
committerserg@serg.mysql.com <>2002-12-02 20:41:34 +0100
commite54134fde720f27e4a613e1be27ae2fb2a521388 (patch)
treeb7af6ce00d861f59100189c21bdbbecfc19addd3 /sql/sql_parse.cc
parent5483796c50a6c74b9d7f6363aba5d39c2739df1b (diff)
parent2320923a7ba43cab44ca350f61d8b7b0ddc3a919 (diff)
downloadmariadb-git-e54134fde720f27e4a613e1be27ae2fb2a521388.tar.gz
merged
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index bb12e4c585d..7f3a4986038 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1972,14 +1972,21 @@ mysql_execute_command(THD *thd)
case SQLCOM_REPLACE:
case SQLCOM_INSERT:
{
+ my_bool update=(lex->value_list.elements ? UPDATE_ACL : 0);
ulong privilege= (lex->duplicates == DUP_REPLACE ?
- INSERT_ACL | DELETE_ACL : INSERT_ACL);
+ INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
if (check_access(thd,privilege,tables->db,&tables->grant.privilege))
goto error; /* purecov: inspected */
if (grant_option && check_grant(thd,privilege,tables))
goto error;
+ if (select_lex->item_list.elements != lex->value_list.elements)
+ {
+ send_error(thd,ER_WRONG_VALUE_COUNT);
+ DBUG_VOID_RETURN;
+ }
res = mysql_insert(thd,tables,lex->field_list,lex->many_values,
- lex->duplicates);
+ select_lex->item_list, lex->value_list,
+ (update ? DUP_UPDATE : lex->duplicates));
if (thd->net.report_error)
res= -1;
break;
@@ -2302,7 +2309,7 @@ mysql_execute_command(THD *thd)
case SQLCOM_LOAD:
{
uint privilege= (lex->duplicates == DUP_REPLACE ?
- INSERT_ACL | UPDATE_ACL | DELETE_ACL : INSERT_ACL);
+ INSERT_ACL | DELETE_ACL : INSERT_ACL);
if (!lex->local_file)
{