distal-attribute
distal-attribute
distal-attribute
distal-attribute

date column default

User, date Message
Written by samhill5215
2 years ago
Category: Feature discussion
13 posts since Sun, 14 Mar 10
Prior to v7 a DATE column would automatically default to today's date when a new row was inserted. This no longer happens. Any ideas on why this change?
Written by jfalchMoney, Euro
2 years ago
354 posts since Sat, 17 Oct 09
yes. a user put up lots of posts on how his company needed this to be so, and it was changed accordingly.
I think of him and his needs every few days when I have to enter lots of expenses into a table by hand, and have to explicitly type today´s date for every one.
Written by ansgar
2 years ago
4801 posts since Fri, 07 Apr 06
Exactly, see issue #2708. I tend to revert that stuff. There are more people asking for this removed feature than there are complaining about this good default value.
Written by samhill5215
2 years ago
13 posts since Sun, 14 Mar 10
Wow, there sure has been lots of discussion on this and I'm almost sorry for opening this can of worms again. Had I been aware of it I would have certainly weighed in.

Here's my take: Although in theory I agree with djdjohnson that heidi shouldn't modify existing values I have to wonder why any good database designer would allow a NULL in a date field? I also agree with jfalch that preventing incorrect data entry is more appropriate of a custom data entry system, not a mysql qui. But that's another discussion.

How about either (or both) of these compromises?

1. Make the default of NULLs a configurable item. Even better, allow defaults to be defined as the result of a function. In my case the default of the DATE column could be the output of curdate(). It would correct what in my view is a serious defect of mysql.

2. Provide a configurable shortcut for the context menu. As it now exists the only shortcut is for the NULL.

In the absence of either it would be wonderful if the context menu were available in edit mode as well. As it now stands, we who liked the previous default behavior now must use quite a few additional keystrokes or mouse clicks to get something that used to be automatic.

Since my solutions will require coding only anse can determine their feasibility. Frankly I'm grateful heidi even exists so thank you anse.
Written by jfalchMoney, Euro
2 years ago
354 posts since Sat, 17 Oct 09
IMHO (1) would be the best solution for everyone; the simple version ("set new DATE fields to today´s date") would probably be sufficient for most.
Written by ansgar
2 years ago
4801 posts since Fri, 07 Apr 06
See issue #2708
Written by ansgar
2 years ago
4801 posts since Fri, 07 Apr 06
Done. See Tools > Preferences > Data > "Prefill empty date/time fields". This is by default checked, so NULLs are again automatically filled with a SELECT NOW() result. If you uncheck that option, the editor starts with an empty mask, and leaving the editor without entering anyting won't touch the originaly value.
Written by jfalchMoney, Euro
2 years ago
354 posts since Sat, 17 Oct 09
Thank you !
Written by samhill5215
2 years ago
13 posts since Sun, 14 Mar 10
Yes indeed anse, thank you. Now could you do the same for DATETIME columns? Also the default for TIMESTAMP columns no longer works when setting it to CURRENT_TIMESTAMP.
Written by ansgar
2 years ago
4801 posts since Fri, 07 Apr 06
All date/datetime/time/timestamp columns should be handled with the above mentioned approach. What exactly does not work?
Written by samhill5215
2 years ago
13 posts since Sun, 14 Mar 10
Oops.. Sorry anse, my mistake. It works as you say. Thanks again.
 

Please login to leave a reply, or register at first.