1

I have a column of TIMESTAMP, NOT NULL, DEFAULT CURRENT_TIMESTAMP.

I want to modify it as TIMESTAMP(3).

I tried

ALTER TABLE <table>
MODIFY COLUMN <column>
TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;

And I got.

Error Code: 1067. Invalid default value for '<column>'

What can I do with it?

1 Answer 1

0

I'm answering for my own question.

I found an answer solves the exact problem.

https://stackoverflow.com/a/23671577/330457

Shortly, I needed to specify the same type for DEFAULT.

ALTER TABLE <table>
MODIFY COLUMN <column>
TIMESTAMP(3)
NOT NULL
DEFAULT CURRENT_TIMESTAMP(3) -- See?
1
  • It's good that you were able to do so. Could you also please mark it as accepted so that others seeking to resolve similar problems can quickly get an answer. You might have to wait? Also, no points :-) - that would be too easy!
    – Vérace
    Commented Dec 5, 2017 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.