No NULL DEFAULT current_timestamp on UPDATE current_timestamp details

Source: Internet
Author: User

' gs_modified ' timestamp not NULL DEFAULT current_timestamp on update current_timestamp COMMENT ' database last update time '

After a big six months, because of some business problems, found such a hidden point.

Not NULL default Current_timestamp, this sentence does not need to participate in the following discussion, this field is not empty, if the new time is empty, the default is stored as the current system time.

Gs_modified, this field is mainly from the business library, and then the cold storage to back up the business library data, the first version is insert into on dumplicate key update

, this table has a primary key, each time the backup is inserted if it does not exist, if it exists, update some fields of business data.

So, on update Current_timestam is effective, if the UPDATE statement, regardless of whether the field is passed over, will be updated to the current time.

And then the logic of the cold backup, into the replace into, so on the UPDATE Current_timestam will not be effective, is always the business library data transfer over the gs_modified.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.