mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-7563 Support CHECK constraint as in (or close to) SQL Standard
MDEV-10134 Add full support for DEFAULT - Added support for using tables with MySQL 5.7 virtual fields, including MySQL 5.7 syntax - Better error messages also for old cases - CREATE ... SELECT now also updates timestamp columns - Blob can now have default values - Added new system variable "check_constraint_checks", to turn of CHECK constraint checking if needed. - Removed some engine independent tests in suite vcol to only test myisam - Moved some tests from 'include' to 't'. Should some day be done for all tests. - FRM version increased to 11 if one uses virtual fields or constraints - Changed to use a bitmap to check if a field has got a value, instead of setting HAS_EXPLICIT_VALUE bit in field flags - Expressions can now be up to 65K in total - Ensure we are not refering to uninitialized fields when handling virtual fields or defaults - Changed check_vcol_func_processor() to return a bitmap of used types - Had to change some functions that calculated cached value in fix_fields to do this in val() or getdate() instead. - store_now_in_TIME() now takes a THD argument - fill_record() now updates default values - Add a lookahead for NOT NULL, to be able to handle DEFAULT 1+1 NOT NULL - Automatically generate a name for constraints that doesn't have a name - Added support for ALTER TABLE DROP CONSTRAINT - Ensure that partition functions register virtual fields used. This fixes some bugs when using virtual fields in a partitioning function
This commit is contained in:
committed by
Sergei Golubchik
parent
23d03a1b1e
commit
db7edfed17
@@ -353,8 +353,6 @@ int mysql_update(THD *thd,
|
||||
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (table->default_field)
|
||||
table->mark_default_fields_for_write();
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
/* Check values */
|
||||
@@ -394,14 +392,6 @@ int mysql_update(THD *thd,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
If a timestamp field settable on UPDATE is present then to avoid wrong
|
||||
update force the table handler to retrieve write-only fields to be able
|
||||
to compare records and detect data change.
|
||||
*/
|
||||
if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) &&
|
||||
table->default_field && table->has_default_function(true))
|
||||
bitmap_union(table->read_set, table->write_set);
|
||||
// Don't count on usage of 'only index' when calculating which key to use
|
||||
table->covering_keys.clear_all();
|
||||
|
||||
@@ -763,7 +753,7 @@ int mysql_update(THD *thd,
|
||||
|
||||
if (!can_compare_record || compare_record(table))
|
||||
{
|
||||
if (table->default_field && table->update_default_fields())
|
||||
if (table->default_field && table->update_default_fields(1, ignore))
|
||||
{
|
||||
error= 1;
|
||||
break;
|
||||
@@ -1716,17 +1706,8 @@ int multi_update::prepare(List<Item> ¬_used_values,
|
||||
{
|
||||
table->read_set= &table->def_read_set;
|
||||
bitmap_union(table->read_set, &table->tmp_set);
|
||||
/*
|
||||
If a timestamp field settable on UPDATE is present then to avoid wrong
|
||||
update force the table handler to retrieve write-only fields to be able
|
||||
to compare records and detect data change.
|
||||
*/
|
||||
if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) &&
|
||||
table->default_field && table->has_default_function(true))
|
||||
bitmap_union(table->read_set, table->write_set);
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
@@ -2117,11 +2098,11 @@ int multi_update::send_data(List<Item> ¬_used_values)
|
||||
|
||||
table->status|= STATUS_UPDATED;
|
||||
store_record(table,record[1]);
|
||||
if (fill_record_n_invoke_before_triggers(thd, table, *fields_for_table[offset],
|
||||
if (fill_record_n_invoke_before_triggers(thd, table,
|
||||
*fields_for_table[offset],
|
||||
*values_for_table[offset], 0,
|
||||
TRG_EVENT_UPDATE))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
/*
|
||||
Reset the table->auto_increment_field_not_null as it is valid for
|
||||
only one row.
|
||||
@@ -2132,7 +2113,7 @@ int multi_update::send_data(List<Item> ¬_used_values)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (table->default_field && table->update_default_fields())
|
||||
if (table->default_field && table->update_default_fields(1, ignore))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if ((error= cur_table->view_check_option(thd, ignore)) !=
|
||||
@@ -2422,7 +2403,8 @@ int multi_update::do_updates()
|
||||
if (!can_compare_record || compare_record(table))
|
||||
{
|
||||
int error;
|
||||
if (table->default_field && (error= table->update_default_fields()))
|
||||
if (table->default_field &&
|
||||
(error= table->update_default_fields(1, ignore)))
|
||||
goto err2;
|
||||
if (table->vfield &&
|
||||
update_virtual_fields(thd, table,
|
||||
|
Reference in New Issue
Block a user