CURRENT_TIMESTAMP

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
brmcdani
Forum Newbie
Posts: 17
Joined: Wed Sep 02, 2009 8:21 pm

CURRENT_TIMESTAMP

Post by brmcdani »

When I enter CURRENT_TIMESTAMP in for my default value it gives me an invalid default value for 'edit time'

My type is int does this need to be different?

Anyone know what I can enter in to make this go away?

The error I get is "Invalid default value for 'edit_time' "
robnet
Forum Commoner
Posts: 85
Joined: Mon Aug 10, 2009 8:32 am
Location: South East, UK

Re: CURRENT_TIMESTAMP

Post by robnet »

current_timestamp would be in the datetime or date format so your field type also needs to be either datetime or date
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: CURRENT_TIMESTAMP

Post by pickle »

As far as I know, there's no way to make the current timestamp be a default value for a column. You can certainly make the default the timestamp for when you create the table, but not the timestamp for when a row is added.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
robnet
Forum Commoner
Posts: 85
Joined: Mon Aug 10, 2009 8:32 am
Location: South East, UK

Re: CURRENT_TIMESTAMP

Post by robnet »

Good point pickle :oops:
Post Reply