Commit 793c3061 authored by unknown's avatar unknown
Browse files

Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt

into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt


mysql-test/r/insert_update.result:
  Auto merged
mysql-test/t/insert_update.test:
  Auto merged
mysql-test/t/skip_grants.test:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_insert.cc:
  merging
parents 0270e811 43b9ff1b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -236,6 +236,17 @@ INSERT INTO t2 VALUES (1), (3);
INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a;
ERROR 42S22: Unknown column 'a' in 'field list'
DROP TABLE t1,t2;
SET SQL_MODE = 'TRADITIONAL';
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);
INSERT INTO t1 (a) VALUES (1);
ERROR HY000: Field 'b' doesn't have a default value
INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b;
ERROR HY000: Field 'b' doesn't have a default value
INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b;
ERROR HY000: Field 'b' doesn't have a default value
SELECT * FROM t1;
a	b
DROP TABLE t1;
CREATE TABLE t1 (f1 INT AUTO_INCREMENT PRIMARY KEY,
f2 VARCHAR(5) NOT NULL UNIQUE);
INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
+12 −0
Original line number Diff line number Diff line
@@ -58,3 +58,15 @@ DROP PROCEDURE p3;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
select count(*) from information_schema.COLUMN_PRIVILEGES;
count(*)
0
select count(*) from information_schema.SCHEMA_PRIVILEGES;
count(*)
0
select count(*) from information_schema.TABLE_PRIVILEGES;
count(*)
0
select count(*) from information_schema.USER_PRIVILEGES;
count(*)
0
+21 −0
Original line number Diff line number Diff line
@@ -163,6 +163,27 @@ INSERT INTO t2 VALUES (1), (3);
INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a;
DROP TABLE t1,t2;

#
# Bug #26261: Missing default value isn't noticed in 
#   insert ... on duplicate key update
#
SET SQL_MODE = 'TRADITIONAL';

CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);

--error 1364
INSERT INTO t1 (a) VALUES (1);

--error 1364
INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b;

--error 1364
INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b;

SELECT * FROM t1;

DROP TABLE t1;

#
# Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
#            touched but not actually changed.
+8 −0
Original line number Diff line number Diff line
@@ -108,3 +108,11 @@ DROP PROCEDURE p3;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;

#
# Bug#26285 Selecting information_schema crahes server
#
select count(*) from information_schema.COLUMN_PRIVILEGES;
select count(*) from information_schema.SCHEMA_PRIVILEGES;
select count(*) from information_schema.TABLE_PRIVILEGES;
select count(*) from information_schema.USER_PRIVILEGES;
+2 −1
Original line number Diff line number Diff line
@@ -991,7 +991,8 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
                          List<Item> &fields, List_item *values,
                          List<Item> &update_fields,
                          List<Item> &update_values, enum_duplicates duplic,
                          COND **where, bool select_insert);
                          COND **where, bool select_insert,
                          bool check_fields, bool abort_on_warning);
bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
                  List<List_item> &values, List<Item> &update_fields,
                  List<Item> &update_values, enum_duplicates flag,
Loading