mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fixed handling of NO_AUTO_VALUE_ON_ZERO
This commit is contained in:
@@ -19,6 +19,7 @@ col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 ndbcluster 9 Dynamic 0 0 0 NULL 0 0 1 NULL NULL NULL latin1_swedish_ci NULL
|
||||
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
|
||||
insert into t1 values
|
||||
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
|
||||
show table status;
|
||||
|
||||
@@ -31,6 +31,7 @@ col4 varchar(4) not null,
|
||||
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
|
||||
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
|
||||
show table status;
|
||||
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
|
||||
insert into t1 values
|
||||
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
|
||||
show table status;
|
||||
|
||||
@@ -1526,7 +1526,11 @@ int ha_ndbcluster::write_row(byte *record)
|
||||
if (table->timestamp_default_now)
|
||||
update_timestamp(record+table->timestamp_default_now-1);
|
||||
has_auto_increment= (table->next_number_field && record == table->record[0]);
|
||||
skip_auto_increment= table->auto_increment_field_not_null;
|
||||
skip_auto_increment=
|
||||
table->next_number_field &&
|
||||
table->next_number_field->val_int() != 0 ||
|
||||
table->auto_increment_field_not_null &&
|
||||
current_thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO;
|
||||
|
||||
if (!(op= trans->getNdbOperation((const NDBTAB *) m_table)))
|
||||
ERR_RETURN(trans->getNdbError());
|
||||
@@ -1546,7 +1550,7 @@ int ha_ndbcluster::write_row(byte *record)
|
||||
{
|
||||
int res;
|
||||
|
||||
if ((has_auto_increment) && (!skip_auto_increment))
|
||||
if (has_auto_increment)
|
||||
update_auto_increment();
|
||||
|
||||
if ((res= set_primary_key(op)))
|
||||
|
||||
Reference in New Issue
Block a user