Bug #121423 BEFORE INSERT trigger causes ER_BAD_NULL_ERROR on NOT NULL generated column

Submitted: 2 Oct 10:58 Modified: 5 Oct 7:12
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S2 (Serious)
Version:8.0.46, 8.4.11, 9.7.2, 26.07 OS:Any
Assigned to: CPU Architecture:Any

[2 Oct 10:58] Laurynas Biveinis
Description:
CREATE TABLE t (a INT, g INT AS (a + 1) STORED NOT NULL);

# Works
INSERT INTO t (a) VALUES (1);
TRUNCATE TABLE t;

CREATE TRIGGER t_before BEFORE INSERT ON t FOR EACH ROW SET @x = 1;

# Fails
INSERT INTO t (a) VALUES (1);

mysqltest: At line 10: Query 'INSERT INTO t (a) VALUES (1)' failed.
ERROR 1048 (23000): Column 'g' cannot be null

See also bug 121393

How to repeat:
See above
[5 Oct 7:12] Chaithra Marsur Gopala Reddy
Hi Laurynas Biveinis,

Thank you for the test case. Verified as described.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.