Bug #72505 Can't use CURRENT_TIMESTAMP on more than one Timestamp
Submitted: 1 May 2014 20:21 Modified: 11 Jul 2014 4:18
Reporter: Kyle McNally Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:6.1.4, 6.1.6 OS:Windows (Microsoft Enterprise Edition build 9200, 64-bit)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[1 May 2014 20:21] Kyle McNally
Description:
When a table has two Timestamp columns, you can't select two columns to have the special default values when right clicking the default field. This used to be the correct behavior v<5.6.5, but this restriction was lifted.

I can type in the correct defaults and they do work. This is only a cosmetic bug when right clicking the Default field.

When I right click on one timestamp default, I can select CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP. When I right click on another timestamp, these options are grayed out.

How to repeat:
Set the Default on one timestamp field.
Try to right click set default on another timestamp field.

Suggested fix:
Don't gray out.
[1 May 2014 22:22] MySQL Verification Team
Thank you for the bug report. I couldn't repeat either modeling or server alive,
please provide a screenshot showing the issue (grayed default field). Thanks.
[2 May 2014 13:06] Kyle McNally
Example of bug

Attachment: 2014-05-02 09_05_42-.png (image/png, text), 11.20 KiB.

[2 May 2014 13:08] Kyle McNally
Regarding the image, I have three columns that are timestamps, I can right-click and select any of the defaults on the first one, but I have to manually type in the rest. Before MySQL 5.6.5, this was correct behavior, but in that version, the restriction for Timestamps was lifted, so you can have those defaults on more than one timestamp column.

Like I said before, this is only a cosmetic bug, If I type in the values in the default column, it works as expected.
[29 May 2014 19:36] Alfredo Kojima
In Model -> Model Options, what is shown for Target MySQL Version?
[30 May 2014 13:00] Kyle McNally
5.7
[18 Jun 2014 9:26] MySQL Verification Team
Hello Kyle,

Thank you for the bug report and feedback.
Verified as described.

Thanks,
Umesh
[18 Jun 2014 9:31] MySQL Verification Team
MySQL version used 5.7.5
WB 6.1.6

Try to create a similar table using WB and you would notice that the option to set default value "CURRENT_TIMESTAMP" for the second column is disabled. 
Work around for now is to manually enter "CURRENT_TIMESTAMP"

CREATE TABLE t
(
  ts1 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
  ts2 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
  ts3 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
);
[25 Jun 2014 23:26] Alfredo Kojima
I can't repeat this unless I set the target mysql version to 5.5
Can you upload a sample model where you have this problem?
[10 Jul 2014 6:39] MySQL Verification Team
I'm agree with Alfredo, if the "Default Target MySQL Version" is set to 5.7/5.6 then the user interface allows to set CURRENT_TIMESTAMP on more than one Timestamp column.

Please set the "Default Target MySQL Version" in the below settings to > 5.5(in my case I set 5.7) and ensure that you close the model, reopen and try to set..

Edit -> Preferences -> Model: MySQL (TAB) -> Default Target MySQL Version 5.6|5.7

and it allowed to set CURRENT_TIMESTAMP on more than one Timestamp column.

PS: If you don't close the WB after setting Default Target MySQL Version to 5.7 from 5.5(which is default) then it doesn't show CURRENT_TIMESTAMP option for second column
[10 Jul 2014 6:45] MySQL Verification Team
Hello Kyle,

Could you please try the suggestion provided by me/Alfredo in earlier notes and confirm if it is working at your end? I would suggest you to download latest WB 6.1.7 and give a try as suggested.

Thanks,
Umesh
[10 Jul 2014 14:54] Kyle McNally
I verified that Workbench was set to 5.7 and it was. My Model->Model Options was set to use defaults from global settings. I unchecked that and went to the Model:MySQL tab and that one was set to 5.5. Not sure if that's a different bug. I changed that (It's a text box, not a drop down) to 5.7, saved, exited and reopened. Now the right click on a timestamp works as expected.
[11 Jul 2014 4:18] MySQL Verification Team
Thank you for checking out our suggestion, and glad to hear that now it works as expected. Closing the bug as Not a Bug. Please feel free to reopen if you face this issue again.

Thanks,
Umesh