| Bug #120237 | DEFAULT(UUID()) allowed at CREATE TABLE but rejected in ALTER TABLE with binary logging enabled | ||
|---|---|---|---|
| Submitted: | 8 Apr 17:05 | Modified: | 9 Apr 8:59 |
| Reporter: | João Martins | Email Updates: | |
| Status: | Documenting | Impact on me: | |
| Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
| Version: | 9.6 and 8.4 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[8 Sep 8:48]
MySQL Admin
Posted by developer: Bug status updated to 'Documenting'

Description: Non‑deterministic DEFAULT expressions (e.g. UUID()) are accepted when defined at CREATE TABLE time, but rejected when the same DEFAULT is added via ALTER TABLE, even when binary logging is enabled in ROW mode. This behaviour might be intentional (for replication safety?), but I did not found explicitly documented it can also be a bug. How to repeat: CREATE TABLE t1 ( i INT, b BINARY(16) DEFAULT (UUID_TO_BIN(UUID()))-- This succeeds ); ALTER TABLE t1 ADD COLUMN c BINARY(16) DEFAULT (UUID_TO_BIN(UUID(), 1)); -- This fails with: ERROR 1674 (HY000)