Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:09:39+00:00 2026-06-17T16:09:39+00:00

brief: I’m experiencing strange MySQL behavior – on update CURRENT_TIMESTAMP attribute is being added

  • 0

brief:

I’m experiencing strange MySQL behavior – on update CURRENT_TIMESTAMP attribute is being added although I don’t want it to be added. I want to find out why is this happening – is it a matter of MySQL server or MySQL Workbench I’m using (v5.2.38).

detail:

I’ve modelled the database structure using EER diagrams, an example table is below:

CREATE  TABLE IF NOT EXISTS `privilege` (
  `id` INT NOT NULL ,
  `name` VARCHAR(64) NOT NULL COMMENT 'privilege name (just a label)' ,
  `created_at` TIMESTAMP NOT NULL COMMENT 'when the privilege was created' ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;

The above script fragment is created using Export > Forward Engineer SQL Create Script inside WorkBench. The created_at column is siginifant here. It is NOT NULL and there is no default value defined for the timestamp when a record is defined. So I guess, that if someone tries to insert a record without defining created_at, an error will be raised.

I run this script inside MySQL server to create the whole structure. And the created structure is different – show create table privilege returns the following:

CREATE TABLE `privilege` (
  `id` int(11) NOT NULL,
  `name` varchar(64) NOT NULL COMMENT 'privilege name (just a label)',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
  CURRENT_TIMESTAMP COMMENT 'when the privilege was created',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Where did “on update current_timestamp” come from? I’m 100% sure that I didn’t choose any appropriate option, so MySQL should not create anything he’s not asked to.

Does anyone have an idea why those clauses are added?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:09:40+00:00Added an answer on June 17, 2026 at 4:09 pm

    As documented under Automatic Initialization and Updating for TIMESTAMP:

    The following rules describe the possibilities for defining the first TIMESTAMP column in a table with the current timestamp for both the default and auto-update values, for one but not the other, or for neither:

    [ deletia ]

    • With neither DEFAULT CURRENT_TIMESTAMP nor ON UPDATE CURRENT_TIMESTAMP, it is the same as specifying both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP.

    [ deletia ]

    To suppress automatic properties for the first TIMESTAMP column, do either of the following:

    • Define the column with a DEFAULT clause that specifies a constant default value.

    • Specify the NULL attribute. This also causes the column to permit NULL values, which means that you cannot assign the current timestamp by setting the column to NULL. Assigning NULL sets the column to NULL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In brief, my problem is that I want to loop through the contents of
Brief googling looks like you're supposed to use MarkupBuilder, but I don't understand it.
Brief description of what i want my VBA to achieve: I'm trying to import
Brief : I have code which works if I don't dispose of the BindingSource
In brief i'm writing a plugin for a Rails app and I want to
BRIEF SUMMARY OF WHAT I WANT: If I take a file name as argument
brief update I might not even bother with a form to submit the data
In brief: my site is not being indexed by Google. Google has a lot
Brief description of requirements (Lots of good answers here, thanks to all, I'll update
BRIEF: hg clone creates path default in /.hg/hgrc, set to where you cloned from.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.