Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Won't Fix
-
5.1.67, 5.2.14, 5.3.12, 5.5.36, 10.0.8
-
None
-
None
Description
I spoke about this in the list moths ago, but I forgot to file a bug.
Try the following code:
DROP TABLE IF EXISTS t; |
CREATE TABLE t (a INT DEFAULT 999) ENGINE = InnoDB; |
DELIMITER ||
|
CREATE TRIGGER t_bi |
BEFORE INSERT |
ON t |
FOR EACH ROW |
BEGIN
|
SET NEW.a = DEFAULT; |
END; |
||
|
DELIMITER ;
|
INSERT INTO t VALUES (0); |
SELECT * FROM t; |
I get no errors, but t.a is NULL (which would be ok if a.t had no default value).
Since I'm not sure about the syntax, I tried DEFAULT(a) and DEFAULT(t.a), but in both cases I got an error. I have no idea if the errors are expected or not, but as far as I understand the syntax in the example should work.