| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Test errors for Unsafe statement generated inside DEFAULT expression |
| 4 |
# |
| 5 |
# ==== Requirements ==== |
| 6 |
# |
| 7 |
# R1. `ALTER TABLE` with a non-deterministic function as a `DEFAULT` expression |
| 8 |
# for an added column should always fail for `BINLOG_FORMAT=MIXED/ROW` with |
| 9 |
# an unsafe statment error - ER_BINLOG_UNSAFE_SYSTEM_FUNCTION |
| 10 |
# |
| 11 |
# R2. `ALTER TABLE` with a deterministic function as a `DEFAULT` expression for |
| 12 |
# an added column should always succeed with `BINLOG_FORMAT=MIXED/ROW`. |
| 13 |
# |
| 14 |
# ==== Implementation ==== |
| 15 |
# |
| 16 |
# Test `ALTER TABLE ... ADD COLUMN ... DEFAULT` statement with both a |
| 17 |
# deterministic and non-deterministic function as the `DEFAULT` expression |
| 18 |
# |
| 19 |
# ==== References ==== |
| 20 |
# WL#9418 Permit default value to be a function or expression, support for LOBs |
| 21 |
# BUG#28799939 DISALLOW ALTER TABLE ADD COLUMN WITH NONDETERMINISTIC DEFAULT, IF BINLOG ENABLED |
| 22 |
# |
| 23 |
|
| 24 |
--source include/have_binlog_format_mixed_or_row.inc |
| 25 |
--source include/master-slave.inc |
| 26 |
|
| 27 |
--echo # Create tables on master |
| 28 |
CREATE TABLE t1 (z VARCHAR(36)); |
| 29 |
|
| 30 |
ALTER TABLE t1 ADD COLUMN a char(36) DEFAULT (PI()); |
| 31 |
--error ER_BINLOG_UNSAFE_SYSTEM_FUNCTION |
| 32 |
ALTER TABLE t1 ADD COLUMN b char(36) DEFAULT (RAND()); |
| 33 |
|
| 34 |
# Clean up |
| 35 |
DROP TABLE t1; |
| 36 |
--source include/rpl_end.inc |