> I want a NON-NULL datetime column and I want mysql REJECT my insert if
that one is not set.

That's fine. But since you're adding a column, all existing rows need a
value for your new column. If you're saying these values must not be
NULL, then what value are these existing rows supposed to get? You need
to specify this in your DEFAULT clause. Otherwise, whether MySQL or any
other SQL database, what you're asking for is a contradiction.

I presume you can alter the table again to drop the DEFAULT clause
afterwards if needed.

I don't have any specialist MySQL knowledge that I'm using here - my
statement is just coming from my general understanding of SQL and your
original error message.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1657989

Title:
  No more able to create non null datetime column

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1657989/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to