-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error 1292: Incorrect datetime value: '0000-00-00' for column 'date_insert' #711
Comments
If I'm reading this correctly, you have So Either convert all your existing zero dates to some non-zero dates, or temporarily remove |
Yep definitely not going to do that :) I know it's super counter intuitive (I had to read the documentation a few times), but bear with me for a second. The doc https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_date says the following :
We are in the second case here (NO_ZERO_DATE enabled but no strict mode) so it should be permitted but produce a warning. It's indeed what happens :
Also on the ghost table :
So even if the sql_mode says NO_ZERO stuff, as strict mode is not enabled, it only produces a warning and still works. Basically what happens here :
Would not happen if run "manually" on the server (you'd have a warning though) |
Right. And so I'm not so happy to support non-strict mode. How happy are you with cloning the repo, editing this line: Line 487 in 4ff5d6a
and building your personal STRICT-free version? |
I'm quite happy with it if it solves the problem :) I'll give it a try and let you know how it turns out. If it does indeed work maybe we could have a "--skip-strict-mode" option ? |
hence my:
But please let me know how it went. |
It worked ok 👍 Finished with ("Applied" is the numbers of events from the binlog applied to the ghost table, right ?) I had to comment the strict mode in more than one place though, just the one you mentionned was not enough, I changed it in two other places after that in the same script (maybe only once in the "correct" place would have been enough, I didn't test that) |
só colocar is null na query: exemplo: select * from USA_TABELA where data_expirar = '0000-00-00 00:00:00' OR data_expirar is null |
I'm trying to alter a column from "DATE" into "DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP" and I'm getting the following error :
Error 1292: Incorrect datetime value: '0000-00-00' for column 'date_insert'
It seems that the copy from the old table goes well (there are lines in the new table) but maybe it does not work as well when processing updates from the binlogs.
ghost command :
gh-ost version is e48844d (a few commits ahead of latest release)
Servers are percona 5.7.19 (master) and 5.7.22 (slave) ; sql_mode on both servers is :
Create for original table :
Some data from both the original table and ghost tables :
(In this case all the date_insert values are '0000-00-00' but it may be set in other tables that we will migrate later)
Here is the log (I anonymized it a little bit):
The text was updated successfully, but these errors were encountered: