← Back to team overview

maria-discuss team mailing list archive

Re: ALTER vs MODIFY to set default on a column

 

Hi, Shane!

On Aug 12, Shane Bishop wrote:
> 
> I originally used a query like this: ALTER TABLE wp_ewwwio_images ALTER
> updated SET DEFAULT CURRENT_TIMESTAMP;
> 
> This was speedy, and worked a treat, but now I'm finding it doesn't work on
> all MySQL servers. Notably, we've run into trouble with sites running
> MariaDB 10.1 and MySQL 5.7, where it says something like this: You have an
> error in your SQL syntax; check the manual that corresponds to your MySQL
> server version for the right syntax to use near CURRENT_TIMESTAMP

Note, the error is "near CURRENT_TIMESTAMP", that is "ALTER updated SET DEFAULT"
was fine.

In MySQL before 8.0.13 and in MariaDB before 10.2.1 one can only use a
signed number in ALTER ... SET DEFAULT.

This is arguably a bug. But it's unlikely that you'll get it fixed in
MySQL 5.7 (and MariaDB 10.1 is beyond EOL already).

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx


Follow ups

References