MySQL Forums
Forum List  »  Triggers

Re: VARCHAR DEFAULT 'user' to record current user name
Posted by: Stephen Aberle
Date: October 23, 2017 11:55AM

Update: Found it, kind of. But not quite, not really.

I had a look at the INFORMATION_SCHEMA.COLUMNS information for my UserName columns. The columns that work correctly are defined with COLUMN_DEFAULT = user(), while the ones that don't work have COLUMN_DEFAULT = 'user'. For the life of me I can't remember what it was that I did to get that user() value in there as the default. When I try (using Heidi) to set it as user() or User(), I just get the quoted string 'user()' or 'User()'.

So I tried using ALTER TABLE:

ALTER TABLE MyTableName
ALTER COLUMN UserName SET DEFAULT user();

-- and of course it works! But my question remains: How did I get that user() value in there to begin with? I'm sure I was using the Heidi table designer to do it. Does it only work when you first define the table? the column??

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: VARCHAR DEFAULT 'user' to record current user name
963
October 23, 2017 11:55AM


Sorry, you can't reply to this topic. It has been closed.

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.