Bug #9248 CURRENT_USER() as DEFAULT clause argument in CREATE/ALTER TABLE statement
Submitted: 17 Mar 2005 12:49 Modified: 17 Mar 2005 15:30
Reporter: Ed Chesstwin Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.10 OS:Windows (Win2000)
Assigned to: CPU Architecture:Any

[17 Mar 2005 12:49] Ed Chesstwin
Description:
mysql> create table dummy (id int,user varchar(255) default CURRENT_USER());
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the rig
ht syntax to use near 'CURRENT_USER())' at line 1

How to repeat:
create table dummy (id int,user varchar(255) default CURRENT_USER());
[17 Mar 2005 15:30] Jorge del Conde
Hi!

This is not a bug in mysql.  It's by design that one can only use constants for defaults.

As a workaround, you might want to consider using triggers in 5.0