distal-attribute
distal-attribute
distal-attribute
distal-attribute

Unable to change default value for a timestamp column

User, date Message
Written by Joselitux
2 years ago
Category: General
21 posts since Mon, 22 Oct 12
Hi all!

using Heidi 7.0.0.4235 I've come to an odd behaviour when setting default value to a timestamp column.

Use this table to check:

CREATE TABLE `TEST_TIMESTAMP` (
`ID` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`first_value` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`fist_date` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`second_date` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'
COLLATE='utf8_general_ci'
ENGINE=InnoDB;



When created, go to "columns" and try to set default values for first_date and second_date to "No Default Value". Click Save. The log below shows :

/* Entering session "Server" */
/* Entering session "Server" */



Close Heidi. Open again and check the table. No change has been made to default values for the aforementioned columns.


Written by kalvaro
2 years ago
593 posts since Thu, 29 Nov 07
Your code has a couple of typos. If I use this:

CREATE TABLE `TEST_TIMESTAMP` (
`ID` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`first_value` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`fist_date` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`second_date` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(ID)
) COLLATE='utf8_general_ci' ENGINE=InnoDB;



... I have no problems altering date fields to "No default".

What's your server version? Does it run in traditional SQL mode? Does the table have data?
Written by Joselitux
2 years ago
21 posts since Mon, 22 Oct 12
I can't. Even with the code you provided. There is no error though. Simply nothing is changed. No warning, no message....nothing.

Server 5.5 enterprise traditional mode
Written by kalvaro
2 years ago
593 posts since Thu, 29 Nov 07
Sorry for the obvious question but... you hit "Save" afterwards, don't you?
Written by Joselitux
2 years ago
21 posts since Mon, 22 Oct 12
Yep
 

Please login to leave a reply, or register at first.