TIMESTAMP field set inconsistently using CURRENT_TIMESTAMP

Issue #245 resolved
Former user created an issue

Originally reported on Google Code with ID 245

What steps will reproduce the problem?
1.create table t(id INTEGER,dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
2.insert row with id value 1, dt value CURRENT_TIMESTAMP
3.dt is now set to 'CURRENT_TIMESTAMP'

What is the expected output? What do you see instead?

dt should have a proper timestamp, like 2014-02-07 16:06:03

What version of the product are you using? On what operating system? Which
Database Extension (PDO/SQLiteDatabase/SQLiteDatabase3 - see Database
structure-tab in phpLiteAdmin)?

Version 1.9.5. Windows 7

Please provide any additional information below.

This *does* work using the Insert option.

Fails to work if a row is edited and saved as a new row.

Reported by ahnkle on 2014-02-07 16:18:50

Comments (3)

  1. Christopher Kramer
    Thanks for reporting, I can confirm this.
    It works using insert (as you say), but not using "insert as a new row" from edit.
    
    Note that when fixing this, it should not only work with CURRENT_TIMESTAMP but any
    default value that is not a string.
    

    Reported by crazy4chrissi on 2014-02-07 16:58:24 - Status changed: Accepted - Labels added: Target-1.9.6

  2. Christopher Kramer
    Okay, when we fix this, we should really remove the redundant code here. There are 2
    places where rows are created which do almost exactly the same thing.
    1. action "row_edit"  if(isset($_POST['new_row'])
    2. action "row_create"
    
    Probably time to move actions into methods because currently it is not easy to trigger
    the 2nd action from the first one.
    

    Reported by crazy4chrissi on 2014-02-07 17:10:10

  3. Christopher Kramer
    Fixed this with revision a09c27fe026f0431771ffc2ebddb46956e52c0ee.
    Unfortunately not enough time to remove the redundancy now, so I more or less copied
    the code from "insert" to "insert as new" so it behaves the same way.
    

    Reported by crazy4chrissi on 2014-12-28 14:49:13 - Status changed: Fixed

  4. Log in to comment