mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
After merge fix
This commit is contained in:
parent
749091a9ec
commit
f75e79e0fc
13 changed files with 84 additions and 74 deletions
|
@ -84,9 +84,28 @@ SET FOREIGN_KEY_CHECKS=0;
|
|||
--error 1022, 1062
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
|
||||
#
|
||||
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
|
||||
#
|
||||
connection master;
|
||||
create table t1(a int auto_increment, key(a));
|
||||
create table t2(a int);
|
||||
insert into t1 (a) values (null);
|
||||
insert into t2 (a) select a from t1 where a is null;
|
||||
insert into t2 (a) select a from t1 where a is null;
|
||||
select * from t2;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t2;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
#
|
||||
# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
|
||||
|
@ -274,3 +293,4 @@ drop table t1, t2;
|
|||
drop function insid;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
|
|
|
@ -1238,7 +1238,14 @@ COLLATIONS COLLATION_NAME
|
|||
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
|
||||
COLUMNS TABLE_SCHEMA
|
||||
COLUMN_PRIVILEGES TABLE_SCHEMA
|
||||
ENGINES ENGINE
|
||||
EVENTS EVENT_SCHEMA
|
||||
FILES TABLE_SCHEMA
|
||||
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
||||
PARTITIONS TABLE_SCHEMA
|
||||
PLUGINS PLUGIN_NAME
|
||||
PROCESSLIST ID
|
||||
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
|
||||
ROUTINES ROUTINE_SCHEMA
|
||||
SCHEMATA SCHEMA_NAME
|
||||
SCHEMA_PRIVILEGES TABLE_SCHEMA
|
||||
|
@ -1269,7 +1276,14 @@ COLLATIONS COLLATION_NAME
|
|||
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME
|
||||
COLUMNS TABLE_SCHEMA
|
||||
COLUMN_PRIVILEGES TABLE_SCHEMA
|
||||
ENGINES ENGINE
|
||||
EVENTS EVENT_SCHEMA
|
||||
FILES TABLE_SCHEMA
|
||||
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
||||
PARTITIONS TABLE_SCHEMA
|
||||
PLUGINS PLUGIN_NAME
|
||||
PROCESSLIST ID
|
||||
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
|
||||
ROUTINES ROUTINE_SCHEMA
|
||||
SCHEMATA SCHEMA_NAME
|
||||
SCHEMA_PRIVILEGES TABLE_SCHEMA
|
||||
|
|
|
@ -73,6 +73,7 @@ CREATE TABLE t1 ( a INT UNIQUE );
|
|||
SET FOREIGN_KEY_CHECKS=0;
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
Got one of the listed errors
|
||||
drop table t1;
|
||||
create table t1(a int auto_increment, key(a));
|
||||
create table t2(a int);
|
||||
insert into t1 (a) values (null);
|
||||
|
|
|
@ -3475,7 +3475,7 @@ SELECT 0.9888889889 * 1.011111411911;
|
|||
0.9998769417899202067879
|
||||
prepare stmt from 'select 1 as " a "';
|
||||
Warnings:
|
||||
Warning 1466 Leading spaces are removed from name ' a '
|
||||
Warning 1546 Leading spaces are removed from name ' a '
|
||||
execute stmt;
|
||||
a
|
||||
1
|
||||
|
|
|
@ -1311,14 +1311,14 @@ create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1;
|
|||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`f1` char(1) default NULL,
|
||||
`f2` char(5) default NULL,
|
||||
`f3` binary(1) default NULL,
|
||||
`f4` binary(5) default NULL,
|
||||
`f5` timestamp NOT NULL default '0000-00-00 00:00:00',
|
||||
`f6` varchar(1) character set utf8 default NULL,
|
||||
`f1` char(1) DEFAULT NULL,
|
||||
`f2` char(5) DEFAULT NULL,
|
||||
`f3` binary(1) DEFAULT NULL,
|
||||
`f4` binary(5) DEFAULT NULL,
|
||||
`f5` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`f6` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
|
||||
`f7` text,
|
||||
`f8` text character set utf8
|
||||
`f8` text CHARACTER SET utf8
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t2;
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
|
|
|
@ -9,24 +9,3 @@
|
|||
-- source include/have_innodb.inc
|
||||
let $engine_type=innodb;
|
||||
-- source extra/rpl_tests/rpl_insert_id.test
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
|
||||
#
|
||||
connection master;
|
||||
create table t1(a int auto_increment, key(a));
|
||||
create table t2(a int);
|
||||
insert into t1 (a) values (null);
|
||||
insert into t2 (a) select a from t1 where a is null;
|
||||
insert into t2 (a) select a from t1 where a is null;
|
||||
select * from t2;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t2;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
|
|
@ -2285,25 +2285,6 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #18759 "Incorrect string to numeric conversion"
|
||||
#
|
||||
# This test is here so that the behavior will not be changed to 4.1
|
||||
# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
|
||||
# will be converted internally to real (double) value and it is not
|
||||
# as accurate as bigint (longlong) for integers. Thus the results may
|
||||
# vary. In 5.1 internally it is decimal, which is a string type and
|
||||
# will be more accurate. Due to rather big changes needed to fix this
|
||||
# in 4.1 or 5.0 it is not desired to do it in the stable versions.
|
||||
#
|
||||
# This test is here only to make sure that behavior is not changed in
|
||||
# 4.1 and 5.0
|
||||
#
|
||||
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
|
||||
#
|
||||
|
@ -2319,6 +2300,7 @@ SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NUL
|
|||
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
|
||||
#
|
||||
# Bug #20954 "avg(keyval) retuns 0.38 but max(keyval) returns an empty set"
|
||||
#
|
||||
|
@ -2349,6 +2331,25 @@ select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
|
|||
DROP TABLE t1,t2;
|
||||
--enable_ps_protocol
|
||||
|
||||
#
|
||||
# Bug #18759 "Incorrect string to numeric conversion"
|
||||
#
|
||||
# This test is here so that the behavior will not be changed to 4.1
|
||||
# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
|
||||
# will be converted internally to real (double) value and it is not
|
||||
# as accurate as bigint (longlong) for integers. Thus the results may
|
||||
# vary. In 5.1 internally it is decimal, which is a string type and
|
||||
# will be more accurate. Due to rather big changes needed to fix this
|
||||
# in 4.1 or 5.0 it is not desired to do it in the stable versions.
|
||||
#
|
||||
# This test is here only to make sure that behavior is not changed in
|
||||
# 4.1 and 5.0
|
||||
#
|
||||
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
|
11
sql/field.cc
11
sql/field.cc
|
@ -4587,19 +4587,12 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
|
|||
|
||||
Field_timestamp::Field_timestamp(bool maybe_null_arg,
|
||||
const char *field_name_arg,
|
||||
struct st_table *table_arg, CHARSET_INFO *cs)
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str((char*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0,
|
||||
NONE, field_name_arg, table_arg, cs)
|
||||
NONE, field_name_arg, cs)
|
||||
{
|
||||
/* For 4.0 MYD and 4.0 InnoDB compatibility */
|
||||
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
|
||||
if (table && !table->timestamp_field &&
|
||||
unireg_check != NONE)
|
||||
{
|
||||
/* This timestamp has auto-update */
|
||||
table->timestamp_field= this;
|
||||
flags|=TIMESTAMP_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -793,10 +793,9 @@ public:
|
|||
Field_timestamp(char *ptr_arg, uint32 len_arg,
|
||||
uchar *null_ptr_arg, uchar null_bit_arg,
|
||||
enum utype unireg_check_arg, const char *field_name_arg,
|
||||
struct st_table *table_arg,
|
||||
TABLE_SHARE *share, CHARSET_INFO *cs);
|
||||
Field_timestamp(bool maybe_null_arg, const char *field_name_arg,
|
||||
struct st_table *table_arg, CHARSET_INFO *cs);
|
||||
CHARSET_INFO *cs);
|
||||
enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
|
@ -1148,9 +1147,9 @@ public:
|
|||
flags|= BLOB_FLAG;
|
||||
}
|
||||
Field_blob(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
|
||||
struct st_table *table_arg, CHARSET_INFO *cs, bool set_packlength)
|
||||
CHARSET_INFO *cs, bool set_packlength)
|
||||
:Field_longstr((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
|
||||
NONE, field_name_arg, table_arg, cs)
|
||||
NONE, field_name_arg, cs)
|
||||
{
|
||||
flags|= BLOB_FLAG;
|
||||
packlength= 4;
|
||||
|
|
|
@ -4037,7 +4037,8 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
|
|||
field= new Field_time(maybe_null, name, &my_charset_bin);
|
||||
break;
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
return new Field_timestamp(maybe_null, name, table, &my_charset_bin);
|
||||
field= new Field_timestamp(maybe_null, name, &my_charset_bin);
|
||||
break;
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
field= new Field_datetime(maybe_null, name, &my_charset_bin);
|
||||
break;
|
||||
|
@ -4072,10 +4073,10 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
|
|||
case MYSQL_TYPE_BLOB:
|
||||
case MYSQL_TYPE_GEOMETRY:
|
||||
if (this->type() == Item::TYPE_HOLDER)
|
||||
field= new Field_blob(max_length, maybe_null, name, table,
|
||||
collation.collation, 1);
|
||||
field= new Field_blob(max_length, maybe_null, name, collation.collation,
|
||||
1);
|
||||
else
|
||||
field= new Field_blob(max_length, maybe_null, name, table, collation.collation);
|
||||
field= new Field_blob(max_length, maybe_null, name, collation.collation);
|
||||
break; // Blob handled outside of case
|
||||
}
|
||||
if (field)
|
||||
|
|
|
@ -639,6 +639,7 @@ void THD::cleanup_after_query()
|
|||
first_successful_insert_id_in_prev_stmt=
|
||||
first_successful_insert_id_in_cur_stmt;
|
||||
first_successful_insert_id_in_cur_stmt= 0;
|
||||
substitute_null_with_insert_id= TRUE;
|
||||
}
|
||||
arg_of_last_insert_id_function= 0;
|
||||
/* Free Items that were created during this execution */
|
||||
|
|
|
@ -730,7 +730,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
|
|||
uint used_fields_buff_size= bitmap_buffer_size(table->s->fields);
|
||||
uint32 *used_fields_buff= (uint32*)thd->alloc(used_fields_buff_size);
|
||||
MY_BITMAP used_fields;
|
||||
bool save_set_query_id= thd->set_query_id;
|
||||
enum_mark_columns save_mark_used_columns= thd->mark_used_columns;
|
||||
DBUG_ENTER("check_key_in_view");
|
||||
|
||||
if (!used_fields_buff)
|
||||
|
@ -746,20 +746,20 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
|
|||
we must not set query_id for fields as they're not
|
||||
really used in this context
|
||||
*/
|
||||
thd->set_query_id= 0;
|
||||
thd->mark_used_columns= MARK_COLUMNS_NONE;
|
||||
/* check simplicity and prepare unique test of view */
|
||||
for (trans= trans_start; trans != trans_end; trans++)
|
||||
{
|
||||
if (!trans->item->fixed && trans->item->fix_fields(thd, &trans->item))
|
||||
{
|
||||
thd->set_query_id= save_set_query_id;
|
||||
thd->mark_used_columns= save_mark_used_columns;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
Item_field *field;
|
||||
/* simple SELECT list entry (field without expression) */
|
||||
if (!(field= trans->item->filed_for_view_update()))
|
||||
{
|
||||
thd->set_query_id= save_set_query_id;
|
||||
thd->mark_used_columns= save_mark_used_columns;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (field->field->unireg_check == Field::NEXT_NUMBER)
|
||||
|
@ -771,7 +771,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
|
|||
*/
|
||||
trans->item= field;
|
||||
}
|
||||
thd->set_query_id= save_set_query_id;
|
||||
thd->mark_used_columns= save_mark_used_columns;
|
||||
/* unique test */
|
||||
for (trans= trans_start; trans != trans_end; trans++)
|
||||
{
|
||||
|
|
|
@ -1095,7 +1095,7 @@ JOIN::optimize()
|
|||
for (ORDER *tmp_order= order; tmp_order ; tmp_order=tmp_order->next)
|
||||
{
|
||||
Item *item= *tmp_order->item;
|
||||
if (item->walk(&Item::is_expensive_processor,(byte*)0))
|
||||
if (item->walk(&Item::is_expensive_processor, 0, (byte*)0))
|
||||
{
|
||||
/* Force tmp table without sort */
|
||||
need_tmp=1; simple_order=simple_group=0;
|
||||
|
@ -7963,7 +7963,8 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
|
|||
Field *field=((Item_field*) args[0])->field;
|
||||
if (field->flags & AUTO_INCREMENT_FLAG && !field->table->maybe_null &&
|
||||
(thd->options & OPTION_AUTO_IS_NULL) &&
|
||||
(thd->first_successful_insert_id_in_prev_stmt > 0))
|
||||
(thd->first_successful_insert_id_in_prev_stmt > 0 &&
|
||||
thd->substitute_null_with_insert_id))
|
||||
{
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
query_cache_abort(&thd->net);
|
||||
|
@ -7986,7 +7987,7 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
|
|||
IS NULL should be mapped to LAST_INSERT_ID only for first row, so
|
||||
clear for next row
|
||||
*/
|
||||
thd->first_successful_insert_id_in_prev_stmt= 0;
|
||||
thd->substitute_null_with_insert_id= FALSE;
|
||||
}
|
||||
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
|
||||
else if (((field->type() == FIELD_TYPE_DATE) ||
|
||||
|
|
Loading…
Add table
Reference in a new issue