I was looking at creating a TRIGGER that will set the value of a column to its DEFAULT if the INSERT value happens to be an empty string.
My TRIGGER looks like this:
This should work for you
SET NEW.a = DEFAULT(NEW.a)
EDIT: It looks like that doesn't work.
Use this workaround
IF NEW.a = '' THEN
SELECT COLUMN_DEFAULT INTO @def
FROM information_schema.COLUMNS
WHERE
table_schema = 'database_name'
AND table_name = 'your_table'
AND column_name = 'a';
SET NEW.a = @def;
END IF;
You can also try
SET NEW.a = DEFAULT(table_name.a)