mysql - SQL query that is bugged in a way I don't understand -


i know title weird, on same bug hours.

i have query

update tournaments set password_req_count = password_req_count + 1 id = 20;

(you can replace 20 anything, not matter)

this query modifies timestamp field called start_timestamp setting computers current hour.

and query fine, there's no bug :

update tournaments set password_req_count = 0 id = 20;

this happening in php code until removed 1 query, stopped. decided try directly executing query myself, without php, , bug still here.

password_req_count int (i mean, checked it, problem isn't here)

this query not appear in query history of mysql (the 1 can pressing "up" key remake query quickly...), , bug doesn't appear locally (it appears on server). note exported local database server's one, same there , here.

the mysql server version 5.5 on server , 5.7 @ home, thought problem updated it, absolutely nothing changed. googled lot this, found no topic talking subject.

i have query logs, sure there nothing edits start_timestamp (except weird bug obviously). not supposed edited anyway.

edit : edited field name password_request_count because password_req_count exists in table. bug still here.

recap here

edit 2 : here video because apparently post not clear enough. notice can't update query again pressing "up" touch, , please notice start_timestamp gets edited if increment password_req_count. http://www.nx-lab.com/bug.mp4

edit 3 : apparently happens if edit other fields (such top_prize)

there couple of things doing this, 1 trigger on table. code show if there any...

show triggers tournaments;  

the other thing, correct answer in case, auto update on datetime column. causes date , time in column updated automatically when there update table.

you can read more here: https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html

if want remove auto update alter table required remove column, timestamp without change on update...

alter table leads modify added_on timestamp not null default current_timestamp 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -