mirror of
https://github.com/MariaDB/server.git
synced 2025-06-03 07:02:23 +03:00
automerge
This commit is contained in:
commit
3823ac329e
@ -1330,4 +1330,12 @@ ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9',
|
|||||||
affected rows: 2
|
affected rows: 2
|
||||||
info: Records: 2 Duplicates: 0 Warnings: 0
|
info: Records: 2 Duplicates: 0 Warnings: 0
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
|
||||||
|
f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
|
||||||
|
INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
|
||||||
|
this should affect no rows as there is no real change
|
||||||
|
ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
|
||||||
|
affected rows: 0
|
||||||
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||||
|
DROP TABLE t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
@ -1046,4 +1046,19 @@ ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9',
|
|||||||
--disable_info
|
--disable_info
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#43508: Renaming timestamp or date column triggers table copy
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
|
||||||
|
f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
|
||||||
|
|
||||||
|
--echo this should affect no rows as there is no real change
|
||||||
|
--enable_info
|
||||||
|
ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
|
||||||
|
--disable_info
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
37
sql/field.cc
37
sql/field.cc
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -6550,20 +6550,9 @@ uint Field::is_equal(Create_field *new_field)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* If one of the fields is binary and the other one isn't return 1 else 0 */
|
|
||||||
|
|
||||||
bool Field_str::compare_str_field_flags(Create_field *new_field, uint32 flag_arg)
|
|
||||||
{
|
|
||||||
return (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
|
|
||||||
!(flag_arg & (BINCMP_FLAG | BINARY_FLAG))) ||
|
|
||||||
(!(new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
|
|
||||||
(flag_arg & (BINCMP_FLAG | BINARY_FLAG))));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint Field_str::is_equal(Create_field *new_field)
|
uint Field_str::is_equal(Create_field *new_field)
|
||||||
{
|
{
|
||||||
if (compare_str_field_flags(new_field, flags))
|
if (field_flags_are_binary() != new_field->field_flags_are_binary())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ((new_field->sql_type == real_type()) &&
|
return ((new_field->sql_type == real_type()) &&
|
||||||
@ -8329,7 +8318,7 @@ uint Field_blob::max_packed_col_length(uint max_length)
|
|||||||
|
|
||||||
uint Field_blob::is_equal(Create_field *new_field)
|
uint Field_blob::is_equal(Create_field *new_field)
|
||||||
{
|
{
|
||||||
if (compare_str_field_flags(new_field, flags))
|
if (field_flags_are_binary() != new_field->field_flags_are_binary())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ((new_field->sql_type == get_blob_type_from_length(max_data_length()))
|
return ((new_field->sql_type == get_blob_type_from_length(max_data_length()))
|
||||||
@ -8889,7 +8878,7 @@ uint Field_enum::is_equal(Create_field *new_field)
|
|||||||
The fields are compatible if they have the same flags,
|
The fields are compatible if they have the same flags,
|
||||||
type, charset and have the same underlying length.
|
type, charset and have the same underlying length.
|
||||||
*/
|
*/
|
||||||
if (compare_str_field_flags(new_field, flags) ||
|
if (new_field->field_flags_are_binary() != field_flags_are_binary() ||
|
||||||
new_field->sql_type != real_type() ||
|
new_field->sql_type != real_type() ||
|
||||||
new_field->charset != field_charset ||
|
new_field->charset != field_charset ||
|
||||||
new_field->pack_length != pack_length())
|
new_field->pack_length != pack_length())
|
||||||
@ -9658,7 +9647,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
fld_length= 0; /* purecov: inspected */
|
fld_length= NULL; /* purecov: inspected */
|
||||||
}
|
}
|
||||||
|
|
||||||
sign_len= fld_type_modifier & UNSIGNED_FLAG ? 0 : 1;
|
sign_len= fld_type_modifier & UNSIGNED_FLAG ? 0 : 1;
|
||||||
@ -9810,8 +9799,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
case MYSQL_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
if (fld_length == NULL)
|
if (fld_length == NULL)
|
||||||
{
|
{
|
||||||
/* Compressed date YYYYMMDDHHMMSS */
|
length= MAX_DATETIME_WIDTH;
|
||||||
length= MAX_DATETIME_COMPRESSED_WIDTH;
|
|
||||||
}
|
}
|
||||||
else if (length != MAX_DATETIME_WIDTH)
|
else if (length != MAX_DATETIME_WIDTH)
|
||||||
{
|
{
|
||||||
@ -9876,7 +9864,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
sql_type= MYSQL_TYPE_NEWDATE;
|
sql_type= MYSQL_TYPE_NEWDATE;
|
||||||
/* fall trough */
|
/* fall trough */
|
||||||
case MYSQL_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
length= 10;
|
length= MAX_DATE_WIDTH;
|
||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
length= 10;
|
length= 10;
|
||||||
@ -9957,6 +9945,17 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (fld_type) {
|
||||||
|
case MYSQL_TYPE_DATE:
|
||||||
|
case MYSQL_TYPE_NEWDATE:
|
||||||
|
case MYSQL_TYPE_TIME:
|
||||||
|
case MYSQL_TYPE_DATETIME:
|
||||||
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
|
charset= &my_charset_bin;
|
||||||
|
flags|= BINCMP_FLAG;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
DBUG_RETURN(FALSE); /* success */
|
DBUG_RETURN(FALSE); /* success */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
sql/field.h
22
sql/field.h
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
/* Copyright 2000-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -610,6 +610,12 @@ protected:
|
|||||||
handle_int64(to, from, low_byte_first_from, table->s->db_low_byte_first);
|
handle_int64(to, from, low_byte_first_from, table->s->db_low_byte_first);
|
||||||
return from + sizeof(int64);
|
return from + sizeof(int64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool field_flags_are_binary()
|
||||||
|
{
|
||||||
|
return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -669,7 +675,6 @@ public:
|
|||||||
friend class Create_field;
|
friend class Create_field;
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
virtual bool str_needs_quotes() { return TRUE; }
|
virtual bool str_needs_quotes() { return TRUE; }
|
||||||
bool compare_str_field_flags(Create_field *new_field, uint32 flags);
|
|
||||||
uint is_equal(Create_field *new_field);
|
uint is_equal(Create_field *new_field);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1284,12 +1289,12 @@ public:
|
|||||||
Field_date(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
|
Field_date(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
|
||||||
enum utype unireg_check_arg, const char *field_name_arg,
|
enum utype unireg_check_arg, const char *field_name_arg,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
|
:Field_str(ptr_arg, MAX_DATE_WIDTH, null_ptr_arg, null_bit_arg,
|
||||||
unireg_check_arg, field_name_arg, cs)
|
unireg_check_arg, field_name_arg, cs)
|
||||||
{}
|
{}
|
||||||
Field_date(bool maybe_null_arg, const char *field_name_arg,
|
Field_date(bool maybe_null_arg, const char *field_name_arg,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
:Field_str((uchar*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
|
:Field_str((uchar*) 0, MAX_DATE_WIDTH, maybe_null_arg ? (uchar*) "": 0,0,
|
||||||
NONE, field_name_arg, cs) {}
|
NONE, field_name_arg, cs) {}
|
||||||
enum_field_types type() const { return MYSQL_TYPE_DATE;}
|
enum_field_types type() const { return MYSQL_TYPE_DATE;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||||
@ -1399,12 +1404,12 @@ public:
|
|||||||
Field_datetime(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
|
Field_datetime(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
|
||||||
enum utype unireg_check_arg, const char *field_name_arg,
|
enum utype unireg_check_arg, const char *field_name_arg,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
:Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg,
|
:Field_str(ptr_arg, MAX_DATETIME_WIDTH, null_ptr_arg, null_bit_arg,
|
||||||
unireg_check_arg, field_name_arg, cs)
|
unireg_check_arg, field_name_arg, cs)
|
||||||
{}
|
{}
|
||||||
Field_datetime(bool maybe_null_arg, const char *field_name_arg,
|
Field_datetime(bool maybe_null_arg, const char *field_name_arg,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
:Field_str((uchar*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
|
:Field_str((uchar*) 0, MAX_DATETIME_WIDTH, maybe_null_arg ? (uchar*) "": 0,0,
|
||||||
NONE, field_name_arg, cs) {}
|
NONE, field_name_arg, cs) {}
|
||||||
enum_field_types type() const { return MYSQL_TYPE_DATETIME;}
|
enum_field_types type() const { return MYSQL_TYPE_DATETIME;}
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
@ -2076,6 +2081,11 @@ public:
|
|||||||
Item *on_update_value, LEX_STRING *comment, char *change,
|
Item *on_update_value, LEX_STRING *comment, char *change,
|
||||||
List<String> *interval_list, CHARSET_INFO *cs,
|
List<String> *interval_list, CHARSET_INFO *cs,
|
||||||
uint uint_geom_type);
|
uint uint_geom_type);
|
||||||
|
|
||||||
|
bool field_flags_are_binary()
|
||||||
|
{
|
||||||
|
return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user