When I edit an entry that has a timestamp even if I
don't have ON UPDATE CURRENT TIMESTAMPT when it
displays the edit screen to modify the entry, it puts
in NOW() for the new value of the TIMESTAMP field.
Example:
users:
id int(11) autoincement
username char(80) default ''
posted_on timestamp default '0000-00-00 00:00:00'
Insert a row...
1, thog, 2005-10-10 10:34:00pm
now when you modify the row, it puts NOW() for the
posted_on field but it should not do that if the person
does not have ON UPDATE CURRENT TIMESTAMP enabled...
So if you don't remove it and i wanna change username
then it would become... unless i change the NOW() to
the blank entry... It should just default to the blank
entry.
1, newuser, newtime
Logged In: YES
user_id=210714
fixed in cvs, please try latest cvs snapshot at
http://www.phpmyadmin.net/cvs tomorrow
Logged In: YES
user_id=1365989
I don't think it's fixed. Maybe you didn't understand what I
mentioned so I attached a screen shot.
PNG File Of The Bug
Logged In: YES
user_id=210714
I cannot reproduce your problem with phpMyAdmin 2.7.0, under
MySQL 4.1.13 and 5.0.15.
Logged In: YES
user_id=1365989
It's definately fixed in the 1.7.0... thanks for the patch
up! It wasn't fixed in 2.6.4-pl4. Close this entry.
Hi,
This bug has come back in 3.1.5. Updated my phpmyadmin to 3.3.2, but the issue is still here.
Moreover, when you click on the "NULL" box, the select box & input box are not emptied anymore.
I tested this with 2.11.10, 3.1.5 and 3.2.2. When the default value for the timestamp field is set to '0000-00-00 00:00:00' and 'on update CURRENT_TIMESTAMP' is not enabled, the timestamp field remains '0000-00-00 00:00:00' after INSERT and UPDATE.
When the default value is set to null, the default insert value is NOW() (in all 3 tested versions), but you can check NULL, of set the value selection box to '' (empty), then the value of the timestamp field will be NULL, or '0000-00-00 00:00:00' respectively.
When inserting with a SQL statement (not using the INSERT form of PMA), the default value is set correctly.
However, when creating a table with a timestamp field, the default value is set to CURRENT TIMESTAMP, even if 'None' is selected as the default value. ('on update CURRENT_TIMESTAMP' is updated by default as well, even if it is not selected)
Selecting NULL as a default value, results in an MySQL error : #1067 - Invalid default value for 'timestamp' (unless allow NULL is checked, of course)
The only way to get '0000-00-00 00:00:00' as a default value in 3.{1|2}.* is by adding it manually (and setting default to 'As defined')
So I guess this bug has not come back, as the timestamp fields are set correctly, according to the chosen default values.
You can question however, the default value of NOW() in the selectionbox when doing an INSERT/UPDATE, when the default value of the timestamp field is set to NULL. This is maybe not what you would suspect when setting the default to NULL.
The real bug is the inability to set the defaults for a timestamp field correctly.
Hello and thanks for your answer.
[QUOTE]
You can question however, the default value of NOW() in the selectionbox
when doing an INSERT/UPDATE, when the default value of the timestamp field
is set to NULL. This is maybe not what you would suspect when setting the
default to NULL.
[/QUOTE]
Indeed, this is the bug I was trying to report... This could lead to database constistency issues, as some columns may be updated even if one user didn't aim to...
Is my bug (ID: 3058133) the same one? I think it is.
If it is, it could be merged, closed or deleted.
Until this bug will be fixed you can set an option in config.inc.php to make this really annoying behaviour disappear:
$cfg['DefaultFunctions']['first_timestamp']='';
I cannot reproduce this bug under version 3.3.8.
not fixed; i can reproduce it in 3.3.8
Testtable and data (of the duplicate bug: 3058133):
CREATE TABLE `test` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`col2` TIMESTAMP NULL DEFAULT NULL,
`col3` VARCHAR(50) NULL DEFAULT NULL,
PRIMARY KEY (`id`)
)
COLLATE='latin1_german2_ci'
ENGINE=MyISAM
ROW_FORMAT=DEFAULT
INSERT INTO `test` (`id`, `col2`, `col3`) VALUES (1, '2010-09-02 13:49:53', '1');
go to the edit page of the row and click save (nothing should change!)