save timestamp default value error

sojuli's profile image sojuli posted 10 months ago in General Permalink

time TIMESTAMP NOT NULL DEFAULT 'CURRENT_TIMESTAMP' COMMENT '',

1 attachment(s):
  • -_20230531111535
croshad's profile image croshad posted 10 months ago Permalink

Don't know if this is what bothers you but ON UPDATE CURRENT_TIMESTAMP() syntax is borked again in latest updates.

ansgar's profile image ansgar posted 10 months ago Permalink

What exactly is broken? I could just successfully add a datetime column to a table on MariaDB 10.3, with expressions in both default and in on update:

ALTER TABLE `test`
    ADD COLUMN `Column 2` DATETIME NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP() AFTER `id`;

Note that query was generated by the table editor.

croshad's profile image croshad posted 10 months ago Permalink

I'm on 12.5.0.6680 (MySQL 8.0.15) and the query i get is: "...DEFAULT CURRENT_TIMESTAMP() ON UPDATE (CURRENT_TIMESTAMP) AFTER..." doing it through the UI, which gives a 1064 error.

I assumed the bracket is misplaced in relation to the variable after "ON UPDATE" (i recall something similar happening in the past) but if it's not, i'll try to play more and find out why i get an invalid query.

croshad's profile image croshad posted 8 months ago Permalink

This still isn't fixed in the latest version. This is the invalid query i get when copying a table:

CREATE TABLEwebshop.test_table_copy(test_columnTIMESTAMP NULL DEFAULT 'CURRENT_TIMESTAMP' ON UPDATE (CURRENT_TIMESTAMP)) COLLATE 'utf8mb4_0900_ai_ci' ENGINE=InnoDB ROW_FORMAT=Dynamic;

MySQL 8.0.15

croshad's profile image croshad posted 8 months ago Permalink

The formating got silly in the previous post:

CREATE TABLE 'test_table_copy' ('test_column' TIMESTAMP NULL DEFAULT 'CURRENT_TIMESTAMP' ON UPDATE (CURRENT_TIMESTAMP)) COLLATE 'utf8mb4_0900_ai_ci' ENGINE=InnoDB ROW_FORMAT=Dynamic;

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