summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2005-09-22 01:48:39 +0400
committerunknown <evgen@moonbone.local>2005-09-22 01:48:39 +0400
commit14deb9632b7416415e67591778fa0bbe3bcb7750 (patch)
tree82542834429510dae504ec72fb07971b184966a8
parenta808e97d8aa9d80ae6f310171eba34a45116518a (diff)
parent1b02a815dde1379635fb1c76065fc056c084705a (diff)
downloadmariadb-git-14deb9632b7416415e67591778fa0bbe3bcb7750.tar.gz
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into moonbone.local:/work/13180-bug-4.1-mysql
-rw-r--r--mysql-test/r/update.result12
-rw-r--r--mysql-test/t/update.test12
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_prepare.cc1
4 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index e35d4e29fe4..d6c1118f90c 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -251,3 +251,15 @@ f1 f2
1 1
2 2
drop table t1,t2;
+create table t1(f1 int);
+select DATABASE();
+DATABASE()
+test
+update t1 set f1=1 where count(*)=1;
+ERROR HY000: Invalid use of group function
+select DATABASE();
+DATABASE()
+test
+delete from t1 where count(*)=1;
+ERROR HY000: Invalid use of group function
+drop table t1;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index e4e751862f1..84e9ced2017 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -215,4 +215,16 @@ UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
select * from t1;
drop table t1,t2;
+#
+# Bug #13180 sometimes server accepts sum func in update/delete where condition
+#
+create table t1(f1 int);
+select DATABASE();
+--error 1111
+update t1 set f1=1 where count(*)=1;
+select DATABASE();
+--error 1111
+delete from t1 where count(*)=1;
+drop table t1;
+
# End of 4.1 tests
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 8636b6542fc..07017451bad 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -160,6 +160,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
lex->proc_list.first= 0;
+ thd->allow_sum_func= 0;
}
void lex_end(LEX *lex)
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 8a50d0bd50e..c8f417c9b9b 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1738,6 +1738,7 @@ static void reset_stmt_for_execute(Prepared_statement *stmt)
lex->current_select= &lex->select_lex;
if (lex->result)
lex->result->cleanup();
+ thd->allow_sum_func= 0;
}