maria-developers team mailing list archive
Mailing list archive
Re: Multiple default values for timestamps
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.
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());