mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt
This commit is contained in:
commit
f470ac2000
18 changed files with 261 additions and 29 deletions
|
@ -734,3 +734,13 @@ f2 group_concat(f1)
|
|||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2
|
||||
drop table t1;
|
||||
CREATE TABLE t1(a TEXT, b CHAR(20));
|
||||
INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3");
|
||||
SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
|
||||
GROUP_CONCAT(DISTINCT UCASE(a))
|
||||
ONE.1,TWO.2,ONE.3
|
||||
SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
|
||||
GROUP_CONCAT(DISTINCT UCASE(b))
|
||||
ONE.1,TWO.2,ONE.3
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -770,6 +770,17 @@ create table t1 (g geometry not null);
|
|||
insert into t1 values(default);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a GEOMETRY);
|
||||
CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
|
||||
CREATE VIEW v2 AS SELECT a FROM t1;
|
||||
DESCRIBE v1;
|
||||
Field Type Null Key Default Extra
|
||||
GeomFromwkb(ASBINARY(a)) geometry YES NULL
|
||||
DESCRIBE v2;
|
||||
Field Type Null Key Default Extra
|
||||
a geometry YES NULL
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1;
|
||||
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
|
||||
create view v1 as select * from t1;
|
||||
desc v1;
|
||||
|
|
|
@ -258,3 +258,81 @@ SELECT LAST_INSERT_ID();
|
|||
LAST_INSERT_ID()
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) PRIMARY KEY auto_increment,
|
||||
`f1` varchar(10) NOT NULL UNIQUE
|
||||
);
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
LAST_INSERT_ID()
|
||||
1
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
1 test1
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test2")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
1 test1
|
||||
2 test2
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test2")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
LAST_INSERT_ID()
|
||||
2
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
1 test1
|
||||
2 test2
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test3")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
LAST_INSERT_ID()
|
||||
3
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
1 test1
|
||||
2 test2
|
||||
3 test3
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) PRIMARY KEY auto_increment,
|
||||
`f1` varchar(10) NOT NULL UNIQUE
|
||||
);
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
LAST_INSERT_ID()
|
||||
1
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
1 test1
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1"),("test4")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
LAST_INSERT_ID()
|
||||
1
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
1 test1
|
||||
2 test4
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) PRIMARY KEY auto_increment,
|
||||
`f1` varchar(10) NOT NULL UNIQUE,
|
||||
tim1 timestamp default '2003-01-01 00:00:00' on update current_timestamp
|
||||
);
|
||||
INSERT INTO t1 (f1) VALUES ("test1");
|
||||
SELECT id, f1 FROM t1;
|
||||
id f1
|
||||
1 test1
|
||||
REPLACE INTO t1 VALUES (0,"test1",null);
|
||||
SELECT id, f1 FROM t1;
|
||||
id f1
|
||||
0 test1
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE='';
|
||||
|
|
|
@ -661,12 +661,6 @@ SELECT * FROM t1 GROUP by t1.a
|
|||
HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c
|
||||
HAVING MAX(t2.b+t1.a) < 10));
|
||||
a b c
|
||||
SELECT a, AVG(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b))
|
||||
AS test FROM t1 GROUP BY a;
|
||||
a AVG(b) test
|
||||
1 4.0000 NULL
|
||||
2 2.0000 k
|
||||
3 2.5000 NULL
|
||||
SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c;
|
||||
a b c
|
||||
1 3 c
|
||||
|
|
|
@ -497,4 +497,14 @@ select f2,group_concat(f1) from t1 group by f2;
|
|||
--disable_metadata
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
#
|
||||
# Bug #26815: Unexpected built-in function behavior: group_concat(distinct
|
||||
# substring_index())
|
||||
#
|
||||
CREATE TABLE t1(a TEXT, b CHAR(20));
|
||||
INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3");
|
||||
SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
|
||||
SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -480,6 +480,18 @@ create table t1 (g geometry not null);
|
|||
insert into t1 values(default);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #27300: create view with geometry functions lost columns types
|
||||
#
|
||||
CREATE TABLE t1 (a GEOMETRY);
|
||||
CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
|
||||
CREATE VIEW v2 AS SELECT a FROM t1;
|
||||
DESCRIBE v1;
|
||||
DESCRIBE v2;
|
||||
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #11335 View redefines column types
|
||||
#
|
||||
|
|
|
@ -195,3 +195,55 @@ SELECT LAST_INSERT_ID();
|
|||
INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
|
||||
SELECT LAST_INSERT_ID();
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#23233: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE in the
|
||||
# NO_AUTO_VALUE_ON_ZERO mode.
|
||||
#
|
||||
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) PRIMARY KEY auto_increment,
|
||||
`f1` varchar(10) NOT NULL UNIQUE
|
||||
);
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
SELECT * FROM t1;
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test2")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT * FROM t1;
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test2")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
SELECT * FROM t1;
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test3")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) PRIMARY KEY auto_increment,
|
||||
`f1` varchar(10) NOT NULL UNIQUE
|
||||
);
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
SELECT * FROM t1;
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1"),("test4")
|
||||
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
|
||||
SELECT LAST_INSERT_ID();
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) PRIMARY KEY auto_increment,
|
||||
`f1` varchar(10) NOT NULL UNIQUE,
|
||||
tim1 timestamp default '2003-01-01 00:00:00' on update current_timestamp
|
||||
);
|
||||
INSERT INTO t1 (f1) VALUES ("test1");
|
||||
SELECT id, f1 FROM t1;
|
||||
REPLACE INTO t1 VALUES (0,"test1",null);
|
||||
SELECT id, f1 FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE='';
|
||||
|
|
|
@ -507,8 +507,9 @@ SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b))
|
|||
SELECT * FROM t1 GROUP by t1.a
|
||||
HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c
|
||||
HAVING MAX(t2.b+t1.a) < 10));
|
||||
SELECT a, AVG(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b))
|
||||
AS test FROM t1 GROUP BY a;
|
||||
#FIXME: Enable this test after fixing bug #27321
|
||||
#SELECT a, AVG(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b))
|
||||
# AS test FROM t1 GROUP BY a;
|
||||
|
||||
SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c;
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
|
|||
if (field == field->table->next_number_field)
|
||||
{
|
||||
field->table->auto_increment_field_not_null= FALSE;
|
||||
return 0; // field is set in handler.cc
|
||||
return 0; // field is set in fill_record()
|
||||
}
|
||||
if (field->table->in_use->count_cuted_fields == CHECK_FIELD_WARN)
|
||||
{
|
||||
|
|
|
@ -1753,7 +1753,6 @@ int handler::update_auto_increment()
|
|||
bool append= FALSE;
|
||||
THD *thd= table->in_use;
|
||||
struct system_variables *variables= &thd->variables;
|
||||
bool auto_increment_field_not_null;
|
||||
DBUG_ENTER("handler::update_auto_increment");
|
||||
|
||||
/*
|
||||
|
@ -1761,11 +1760,9 @@ int handler::update_auto_increment()
|
|||
than the interval, but not smaller.
|
||||
*/
|
||||
DBUG_ASSERT(next_insert_id >= auto_inc_interval_for_cur_row.minimum());
|
||||
auto_increment_field_not_null= table->auto_increment_field_not_null;
|
||||
table->auto_increment_field_not_null= FALSE; // to reset for next row
|
||||
|
||||
if ((nr= table->next_number_field->val_int()) != 0 ||
|
||||
auto_increment_field_not_null &&
|
||||
table->auto_increment_field_not_null &&
|
||||
thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -4363,13 +4363,16 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
|
|||
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||
case MYSQL_TYPE_LONG_BLOB:
|
||||
case MYSQL_TYPE_BLOB:
|
||||
case MYSQL_TYPE_GEOMETRY:
|
||||
if (this->type() == Item::TYPE_HOLDER)
|
||||
field= new Field_blob(max_length, maybe_null, name, collation.collation,
|
||||
1);
|
||||
else
|
||||
field= new Field_blob(max_length, maybe_null, name, collation.collation);
|
||||
break; // Blob handled outside of case
|
||||
case MYSQL_TYPE_GEOMETRY:
|
||||
return new Field_geom(max_length, maybe_null, name, table,
|
||||
(Field::geometry_type)
|
||||
((Item_geometry_func *)this)->get_geometry_type());
|
||||
}
|
||||
if (field)
|
||||
field->init(table);
|
||||
|
|
|
@ -419,7 +419,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
|
|||
break;
|
||||
case STRING_RESULT:
|
||||
if (max_length/collation.collation->mbmaxlen <= 255 ||
|
||||
max_length/collation.collation->mbmaxlen >=UINT_MAX16 ||
|
||||
convert_blob_length >=UINT_MAX16 ||
|
||||
!convert_blob_length)
|
||||
return make_string_field(table);
|
||||
field= new Field_varstring(convert_blob_length, maybe_null,
|
||||
|
|
|
@ -2338,6 +2338,9 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||
table->insert_values= 0;
|
||||
table->fulltext_searched= 0;
|
||||
table->file->ft_handler= 0;
|
||||
/* Catch wrong handling of the auto_increment_field_not_null. */
|
||||
DBUG_ASSERT(!table->auto_increment_field_not_null);
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
if (table->timestamp_field)
|
||||
table->timestamp_field_type= table->timestamp_field->get_auto_set_type();
|
||||
table->pos_in_table_list= table_list;
|
||||
|
@ -6238,6 +6241,11 @@ err_no_arena:
|
|||
values values to fill with
|
||||
ignore_errors TRUE if we should ignore errors
|
||||
|
||||
NOTE
|
||||
fill_record() may set table->auto_increment_field_not_null and a
|
||||
caller should make sure that it is reset after their last call to this
|
||||
function.
|
||||
|
||||
RETURN
|
||||
FALSE OK
|
||||
TRUE error occured
|
||||
|
@ -6250,27 +6258,52 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values,
|
|||
List_iterator_fast<Item> f(fields),v(values);
|
||||
Item *value, *fld;
|
||||
Item_field *field;
|
||||
TABLE *table= 0;
|
||||
DBUG_ENTER("fill_record");
|
||||
|
||||
/*
|
||||
Reset the table->auto_increment_field_not_null as it is valid for
|
||||
only one row.
|
||||
*/
|
||||
if (fields.elements)
|
||||
{
|
||||
/*
|
||||
On INSERT or UPDATE fields are checked to be from the same table,
|
||||
thus we safely can take table from the first field.
|
||||
*/
|
||||
fld= (Item_field*)f++;
|
||||
if (!(field= fld->filed_for_view_update()))
|
||||
{
|
||||
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), fld->name);
|
||||
goto err;
|
||||
}
|
||||
table= field->field->table;
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
f.rewind();
|
||||
}
|
||||
while ((fld= f++))
|
||||
{
|
||||
if (!(field= fld->filed_for_view_update()))
|
||||
{
|
||||
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), fld->name);
|
||||
DBUG_RETURN(TRUE);
|
||||
goto err;
|
||||
}
|
||||
value=v++;
|
||||
Field *rfield= field->field;
|
||||
TABLE *table= rfield->table;
|
||||
table= rfield->table;
|
||||
if (rfield == table->next_number_field)
|
||||
table->auto_increment_field_not_null= TRUE;
|
||||
if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
|
||||
{
|
||||
my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(thd->net.report_error);
|
||||
err:
|
||||
if (table)
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -6319,6 +6352,11 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
|
|||
values list of fields
|
||||
ignore_errors TRUE if we should ignore errors
|
||||
|
||||
NOTE
|
||||
fill_record() may set table->auto_increment_field_not_null and a
|
||||
caller should make sure that it is reset after their last call to this
|
||||
function.
|
||||
|
||||
RETURN
|
||||
FALSE OK
|
||||
TRUE error occured
|
||||
|
@ -6329,19 +6367,38 @@ fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
|
|||
{
|
||||
List_iterator_fast<Item> v(values);
|
||||
Item *value;
|
||||
TABLE *table= 0;
|
||||
DBUG_ENTER("fill_record");
|
||||
|
||||
Field *field;
|
||||
/*
|
||||
Reset the table->auto_increment_field_not_null as it is valid for
|
||||
only one row.
|
||||
*/
|
||||
if (*ptr)
|
||||
{
|
||||
/*
|
||||
On INSERT or UPDATE fields are checked to be from the same table,
|
||||
thus we safely can take table from the first field.
|
||||
*/
|
||||
table= (*ptr)->table;
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
}
|
||||
while ((field = *ptr++))
|
||||
{
|
||||
value=v++;
|
||||
TABLE *table= field->table;
|
||||
table= field->table;
|
||||
if (field == table->next_number_field)
|
||||
table->auto_increment_field_not_null= TRUE;
|
||||
if (value->save_in_field(field, 0) == -1)
|
||||
DBUG_RETURN(TRUE);
|
||||
goto err;
|
||||
}
|
||||
DBUG_RETURN(thd->net.report_error);
|
||||
|
||||
err:
|
||||
if (table)
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -753,6 +753,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||
table->next_number_field->val_int() : 0));
|
||||
table->next_number_field=0;
|
||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
if (duplic != DUP_ERROR || ignore)
|
||||
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
|
||||
if (duplic == DUP_REPLACE &&
|
||||
|
@ -2689,6 +2690,7 @@ select_insert::~select_insert()
|
|||
if (table)
|
||||
{
|
||||
table->next_number_field=0;
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
table->file->ha_reset();
|
||||
}
|
||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
||||
|
|
|
@ -512,6 +512,7 @@ err:
|
|||
mysql_unlock_tables(thd, thd->lock);
|
||||
thd->lock=0;
|
||||
}
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
thd->abort_on_warning= 0;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
@ -609,8 +610,6 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||
{
|
||||
uint length;
|
||||
byte save_chr;
|
||||
if (field == table->next_number_field)
|
||||
table->auto_increment_field_not_null= TRUE;
|
||||
if ((length=(uint) (read_info.row_end-pos)) >
|
||||
field->field_length)
|
||||
length=field->field_length;
|
||||
|
|
|
@ -8982,20 +8982,19 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
|
|||
|
||||
enum enum_field_types type;
|
||||
/*
|
||||
DATE/TIME fields have STRING_RESULT result type. To preserve
|
||||
type they needed to be handled separately.
|
||||
DATE/TIME and GEOMETRY fields have STRING_RESULT result type.
|
||||
To preserve type they needed to be handled separately.
|
||||
*/
|
||||
if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
|
||||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE ||
|
||||
type == MYSQL_TYPE_TIMESTAMP)
|
||||
type == MYSQL_TYPE_TIMESTAMP || type == MYSQL_TYPE_GEOMETRY)
|
||||
new_field= item->tmp_table_field_from_field_type(table, 1);
|
||||
/*
|
||||
Make sure that the blob fits into a Field_varstring which has
|
||||
2-byte lenght.
|
||||
*/
|
||||
else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
|
||||
item->max_length/item->collation.collation->mbmaxlen < UINT_MAX16
|
||||
&& convert_blob_length)
|
||||
convert_blob_length < UINT_MAX16 && convert_blob_length)
|
||||
new_field= new Field_varstring(convert_blob_length, maybe_null,
|
||||
item->name, table->s,
|
||||
item->collation.collation);
|
||||
|
|
|
@ -6838,7 +6838,9 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
|||
copy_ptr->do_copy(copy_ptr);
|
||||
}
|
||||
prev_insert_id= to->file->next_insert_id;
|
||||
if ((error=to->file->ha_write_row((byte*) to->record[0])))
|
||||
error=to->file->write_row((byte*) to->record[0]);
|
||||
to->auto_increment_field_not_null= FALSE;
|
||||
if (error)
|
||||
{
|
||||
if (!ignore ||
|
||||
to->file->is_fatal_error(error, HA_CHECK_DUP))
|
||||
|
|
|
@ -439,6 +439,11 @@ struct st_table {
|
|||
my_bool no_cache;
|
||||
/* To signal that we should reset query_id for tables and cols */
|
||||
my_bool clear_query_id;
|
||||
/*
|
||||
To indicate that a non-null value of the auto_increment field
|
||||
was provided by the user or retrieved from the current record.
|
||||
Used only in the MODE_NO_AUTO_VALUE_ON_ZERO mode.
|
||||
*/
|
||||
my_bool auto_increment_field_not_null;
|
||||
my_bool insert_or_update; /* Can be used by the handler */
|
||||
my_bool alias_name_used; /* true if table_name is alias */
|
||||
|
|
Loading…
Reference in a new issue