can not alter table because of datatime default value

refusea's profile image refusea posted 5 months ago in General Permalink

I create a table with a datatime field, it's default value is CURRENT_TIMESTAMP;

Heidisql will change it's default value to now() automatic;

When i modify some column of the table, it will raise an error cause that datetime field's default value is now()

I do not konw how to avoid this situation and why?

3 attachment(s):
  • HEIDISQL-1
  • HEIDISQL-2
  • HEIDISQL-3
ansgar's profile image ansgar posted 5 months ago Permalink

HeidiSQL itself does not do that, I guess the server does. However, altering the table again should not result in an error. What server version is it? And please ensure you have the latest HeidiSQL version.

refusea's profile image refusea posted 5 months ago Permalink

i use the latest version:12.6.0.6765;

when i create tabel in command line, CURRENT_TIMESTAMP always CURRENT_TIMESTAMP; but in heidisql ui, it automatic change to now()

my sql-server version:

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 23 Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

1 attachment(s):
  • h
refusea's profile image refusea posted 5 months ago Permalink

if i create table from command line, then open the table by heidisql ui, the CURRENT_TIMESTAMP look like this

2 attachment(s):
  • h2
  • h3

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