Commit graph

10 commits

Author SHA1 Message Date
Sergei Golubchik
a8a22b7af2 support 'alter online table t1 page_checksum=0' 2023-08-15 10:16:11 +02:00
Sergei Golubchik
45e0373a78 MDEV-28632 Change default of explicit_defaults_for_timestamp to ON 2022-08-10 15:03:22 +02:00
Marko Mäkelä
7b492d6a70 MDEV-26458 Crash on ALTER TABLE after DISCARD TABLESPACE
ha_innobase::check_if_supported_inplace_alter(): Do not invoke
innobase_table_is_empty() if the tablespace has been discarded.
That is, native ALTER TABLE in InnoDB will treat an empty table
in the same way as a tablespace whose tablespace has been discarded.
(Note: ALTER TABLE...ALGORITHM=COPY will fail if the tablespace
has been discarded.)

This fixes a crash that was introduced
in commit c755974775 (MDEV-19611).
2021-08-23 09:13:55 +03:00
Thirunarayanan Balathandayuthapani
c755974775 MDEV-19611 INPLACE ALTER does not fail on bad implicit default value
- Inplace alter shouldn't set default date column as '0000-00-00' when
table is not empty. So mysql_inplace_alter_table() copied
alter_ctx.error_if_not_empty to a new field of Alter_inplace_info.
In ha_innobase::check_if_supported_inplace_alter() should check the
error_if_not_empty flag and return INPLACE_NOT_SUPPORTED if the table
is not empty
2020-04-28 11:59:32 +05:30
Marko Mäkelä
446b3ebdfc Merge 10.2 into 10.3
FIXME: Properly resolve conflicts between MDEV-18883
and MDEV-7742/MDEV-8305, and record the correct result for
main.log_slow
2019-03-05 12:56:05 +02:00
Thirunarayanan Balathandayuthapani
88aaf590ac MDEV-16365 Setting a column NOT NULL fails to return error for
NULL values when there is no DEFAULT

Copy and inplace algorithm works similarly for
NULL to NOT NULL conversion for the following cases:
(1) strict sql mode - Should give error.
(2) non-strict sql mode - Should give warnings alone
(3) alter ignore table command. - Should give warnings alone.
2018-06-25 14:52:38 +05:30
Thirunarayanan Balathandayuthapani
4f9977d8d3 MDEV-14168 Unconditionally allow ALGORITHM=INPLACE for setting a column NOT NULL
- Allow NOT NULL constraint to replace the NULL value in the row with
explicit or implicit default value.

- If the default value is non-const value then inplace alter won't
support it.

- ALTER IGNORE will ignore the error if the concurrent DML contains
NULL value.
2018-04-24 13:15:35 +05:30
Marko Mäkelä
29624ea304 MDEV-13176 ALTER TABLE…CHANGE col col TIMESTAMP NOT NULL DEFAULT… fails
When it comes to DEFAULT values of columns, InnoDB is imposing both
unnecessary and insufficient conditions on whether ALGORITHM=INPLACE
should be allowed for ALTER TABLE.

When changing an existing column to NOT NULL, any NULL values in the
columns only get a special treatment if the column is changed to an
AUTO_INCREMENT column (which is not supported by ALGORITHM=INPLACE)
or the column type is TIMESTAMP. In all other cases, an error
must be reported for the failure to convert a NULL value to NOT NULL.

InnoDB was unnecessarily interested in whether the DEFAULT value
is not constant when altering other than TIMESTAMP columns. Also,
when changing a TIMESTAMP column to NOT NULL, InnoDB was performing
an insufficient check, and it was incorrectly allowing a constant
DEFAULT value while not being able to replace NULL values with that
constant value.

Furthermore, in ADD COLUMN, InnoDB is unnecessarily rejecting certain
nondeterministic DEFAULT expressions (depending on the session
parameters or the current time).
2017-06-27 07:39:42 +03:00
Marko Mäkelä
0627a0f399 MDEV-12586 ALTER TABLE…ALGORITHM=INPLACE fails with non-constant DEFAULT values
ha_innobase::check_if_supported_inplace_alter(): For now, reject
ALGORITHM=INPLACE when a non-constant DEFAULT expression is specified
for ADD COLUMN or for changing a NULL column to NOT NULL.

Later, we should evaluate the non-constant column values in these cases.
2017-05-08 22:07:52 +03:00
Jan Lindström
1a8cf15d63 MDEV-8392: Couldn't alter field with default value for make it not nullable.
Analysis; Problem is that InnoDB does not have support for generating
CURRENT_TIMESTAMP or constant default.

Fix: Add additional check if column has changed from NULL -> NOT NULL
and column default has changed. If this is is first column definition
whose SQL type is TIMESTAMP and it is defined as NOT NULL and
it has either constant default or function default we must use
"Copy" method for alter table.
2015-06-30 22:24:37 +03:00