Home mysql uses "on update" and sets a default albeit I never told it to do so
Reply: 0

mysql uses "on update" and sets a default albeit I never told it to do so

user608
1#
user608 Published in April 20, 2018, 10:49 am

I executed the following query on my mysql server:

CREATE TABLE user(
  created_at timestamp NOT NULL,
  updated_at timestamp NOT NULL,
  id integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
  count integer NOT NULL,
  name varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci

When I looked into phpmyadmin I was suprised. The created_at column had a default set to CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP was also there.

How can this even happen? It shouldnt do that, right?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.350756 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO