Home > Database > Mysql Tutorial > What Were the Restrictions on Using CURRENT_TIMESTAMP with TIMESTAMP Columns in MySQL Before Version 5.6.5?

What Were the Restrictions on Using CURRENT_TIMESTAMP with TIMESTAMP Columns in MySQL Before Version 5.6.5?

Barbara Streisand
Release: 2024-12-15 16:20:13
Original
856 people have browsed it

What Were the Restrictions on Using CURRENT_TIMESTAMP with TIMESTAMP Columns in MySQL Before Version 5.6.5?

Restrictions on TIMESTAMP Columns with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE Clauses in MySQL Versions Prior to 5.6.5

Historically, in MySQL versions prior to 5.6.5, there was a restriction that limited a table to have only one TIMESTAMP column with either a DEFAULT CURRENT_TIMESTAMP or ON UPDATE CURRENT_TIMESTAMP clause. This limitation extended to INT, BIGINT, and SMALLINT integers back when they were initially introduced in 2008.

This limitation stemmed from legacy implementation concerns that necessitated a specific implementation for the CURRENT_TIMESTAMP functionality.

Error Message and Related Issues

For example, consider the following table definition, which attempts to define two TIMESTAMP columns with the CURRENT_TIMESTAMP value:

This definition would result in the following error:

Error Code : 1293<br>Incorrect table definition; there can<br>be only one TIMESTAMP column with<br>CURRENT_TIMESTAMP in DEFAULT or ON<br>UPDATE clause

This error indicated that the table definition violated the aforementioned restriction.

Removal of Restriction

Despite the technical foundation for this limitation, the MySQL team recognized its inconvenience. Subsequently, in MySQL 5.6.5 (released on April 10th, 2012), the restriction was lifted.

The change log for this update stated:

The above is the detailed content of What Were the Restrictions on Using CURRENT_TIMESTAMP with TIMESTAMP Columns in MySQL Before Version 5.6.5?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template