← Back to team overview

maria-developers team mailing list archive

Re: Multiple default values for timestamps


Hi, Dolf!

On Jan 09, Dolf Schimmel wrote:
> Hey Sergei,
> Thanks for replying.
> > Then insert few rows and see how it works.
> That was exactly the thing I was struggling with. How should I know in
> the tests what the time was at the moment the query was executed? I
> did a few already, but I reckon they're probably insufficient.
> http://bazaar.launchpad.net/~freeaqingme/maria/improv-allowMultipleCurTimestampInDefaultOnTable/revision/2877

I wouldn't worry about that, just try to verify that timestamps with the
default get NOW() and timestamps without the default get all NULL.

But anyway, you can know the moment the query was executed by creating
another column of DATETIME or CHAR/VARCHAR type, and explicitly
inserting NOW() into it:

  INSERT t1 (datetime_column) VALUES (NOW());