← Back to team overview

maria-discuss team mailing list archive

Re: ALTER vs MODIFY to set default on a column

 

Thanks for the additional info Sergei, I might file a bug just to see what
happens for MySQL 5.7, but since MariaDB 10.1 is EOL, I'll leave that lie :)
In the meantime, I've had some ideas on how to work around this a bit
better, thanks Roberto also for your suggestions. I think WP is already
catching the error to prevent PHP from falling over completely, so that
helps.

Best,
Shane

On Fri, Aug 13, 2021 at 1:59 AM Sergei Golubchik <serg@xxxxxxxxxxx> wrote:

> 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
>

References