Menu

#1831 (ok 3.3.9) Update With TIMESTAMP

3.3.2
fixed
1
2013-06-11
2005-10-22
Thog
No

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

Discussion

1 2 > >> (Page 1 of 2)
  • Marc Delisle

    Marc Delisle - 2005-10-23
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2005-10-23
    • summary: Update With TIMESTAMP puts it to NOW() if not ON UPDA CUR TS --> (in 2.7.0) Update With TIMESTAMP
    • priority: 5 --> 1
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2005-10-23

    Logged In: YES
    user_id=210714

    fixed in cvs, please try latest cvs snapshot at
    http://www.phpmyadmin.net/cvs tomorrow

     
  • Thog

    Thog - 2005-12-01

    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.

     
  • Thog

    Thog - 2005-12-01

    PNG File Of The Bug

     
  • Marc Delisle

    Marc Delisle - 2005-12-04
    • summary: (in 2.7.0) Update With TIMESTAMP --> Update With TIMESTAMP
    • priority: 1 --> 5
    • status: open-fixed --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2005-12-06
    • priority: 5 --> 3
     
  • Marc Delisle

    Marc Delisle - 2005-12-06

    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.

     
  • Thog

    Thog - 2005-12-06
    • status: open-accepted --> closed-accepted
     
  • Thog

    Thog - 2005-12-06

    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.

     
  • Julien Risse

    Julien Risse - 2010-05-11

    Hi,
    This bug has come back in 3.1.5. Updated my phpmyadmin to 3.3.2, but the issue is still here.

     
  • Marc Delisle

    Marc Delisle - 2010-05-12
    • status: closed-accepted --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2010-05-12
    • milestone: 532128 --> 3.3.2
    • assigned_to: lem9 --> nobody
     
  • Julien Risse

    Julien Risse - 2010-05-12

    Moreover, when you click on the "NULL" box, the select box & input box are not emptied anymore.

     
  • Dieter Adriaenssens

    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.

     
  • Julien Risse

    Julien Risse - 2010-06-14

    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...

     
  • geki007

    geki007 - 2010-09-03

    Is my bug (ID: 3058133) the same one? I think it is.
    If it is, it could be merged, closed or deleted.

     
  • Dieter Adriaenssens

    • priority: 3 --> 7
     
  • Iplexx

    Iplexx - 2010-10-12

    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']='';

     
  • Marc Delisle

    Marc Delisle - 2010-11-04
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2010-11-04
    • status: open-accepted --> pending-accepted
     
  • Marc Delisle

    Marc Delisle - 2010-11-04

    I cannot reproduce this bug under version 3.3.8.

     
  • geki007

    geki007 - 2010-11-04

    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!)

     
  • Marc Delisle

    Marc Delisle - 2010-11-04
    • status: pending-accepted --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2010-11-04
    • summary: Update With TIMESTAMP --> (ok 3.3.9) Update With TIMESTAMP
    • priority: 7 --> 1
    • status: open-accepted --> open-fixed
     
1 2 > >> (Page 1 of 2)