I started to have the following error running
# drush mi xxxx --limit=1
exception 'PDOException' with message 'SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: [error]
''' in includes/database/database.inc:2171
Stack trace:
#0 includes/database/database.inc(2171): PDOStatement->execute(Array)
#1 includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)
#2 includes/database/query.inc(1177): DatabaseConnection->query('UPDATE {migrate...', Array,
Array)
#3 sites/all/modules/migrate/includes/base.inc(820): UpdateQuery->execute()
#4 sites/all/modules/migrate/includes/migration.inc(758):
MigrationBase->saveHighwater('1268764286')
#5 sites/all/modules/migrate/includes/base.inc(1073): Migration->import()
#6 sites/all/modules/migrate/migrate.drush.inc(1234): MigrationBase->processImport(Array)
#7 [internal function]: drush_migrate_import('Blog')
#8 /usr/local/src/drush/includes/command.inc(359): call_user_func_array('drush_migrate_i...', Array)
#9 /usr/local/src/drush/includes/command.inc(210): _drush_invoke_hooks(Array, Array)
#10 [internal function]: drush_command('Blog')
#11 /usr/local/src/drush/includes/command.inc(178): call_user_func_array('drush_command', Array)
#12 /usr/local/src/drush/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#13 /usr/local/src/drush/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#14 /usr/local/src/drush/drush.php(11): drush_main()
I tracked this down to the following:
default:
// CAST(highwater AS INTEGER) would be ideal, but won't // work in MySQL. This hack is thought to be
$query->where('(highwater+0) < :highwater', array(':highwater' => $highwater));
It may be local to my current setup, but nonetheless worrisome. I have Maria DB 10.1.8 installed and PHP Version 5.4.45 with PDO Driver for MySQL enabled
Client API version mysqlnd 5.0.10 - 20111026.
For some reason the following SQL
UPDATE migrate_status SET highwater='1268764286'
WHERE (machine_name = 'Blog') AND ((highwater+0) < 1268764286)
Works on the mysqlclient, but as soon as I try to run it on a drupal site with db_query() I get the same error as with drush. This only happens when highwater is empty, not when there's an actual value in it, even if it's just 0.
This was on migrate for quite a bit. It says there in the comment that CAST is not available in mysql, I am not sure that's the case.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | migrate-cast-2635792-13.patch | 882 bytes | nedjo |
Comments
Comment #2
hanoiiAttached is a patch that does the same think with a different approach that seems not to through any error and also seems even more flexible than the hack already in place.
Comment #3
glass.dimly commentedSame error. Patch tested and working to fix against migrate 7.x-2.8. Thanks for the patch!
Comment #4
eneko1907 commentedSame error observed on a clean 7.50 install, migrating content from D6.
Patch worked nicely, many thanks.
Comment #5
ElleKitty commented+1 "patch works for me", also D6 to 7, also old MySQL to MariaDb 10.1. Seems worth pushing for the patch to be accepted.
Comment #6
immanuel.paul commented+1"patch works for me", D7 to D7. Patch can be accepted ASAP.
Comment #7
nedjoClosed #2713563: Truncated incorrect DOUBLE value message with highwater as a duplicate.
Mike Ryan had commented there (#2):
Comment #8
nedjoThe current patch avoids the error only in the case that the existing highmark is NULL or an empty string. Because the
highwater+0fallback is retained, any other value will still trigger the error.Comment #9
nedjoActually, it looks like we can simply remove this hack. It's left over from the 6.x-2.x version and no longer needed.
CASTsupport has been in MySQL since at least 5.0 (see the MySQL 5.0 manual). Drupal 6 required MySQL 4.1.1. or higher. But Drupal 7 requires MySQL 5.0.15 or higher, so we can assumeCASTsupport.Patch attached.
Comment #11
nedjoForgot to delete a line.
Comment #13
nedjoMySQL casts and converts as
SIGNEDorUNSIGNEDrather thanINTEGER(docs).Comment #14
joelpittetThis worked for me, thank you @nedjo
Comment #15
wrg20 commented#13 worked for me. Thank you #nedjo
Comment #16
mrP commented+1 RTBC @nedjo #13
Comment #17
web247 commented#13 worked for me nicely, thanks.
Comment #18
khiminrm commented#13 works for me. Thanks!
Comment #19
zythyr commented#13 patch worked for me. Thanks!
Comment #20
Grayside commented#13 worked for me.
Comment #21
ShutterFreak commented#13 worked for me, while migrating from D6.38 on MariaDB to D7.56 on MariaDB. Both Drupal instances shared the same DB.
Comment #22
yurg commented#13 works for me too. +1 for commit.
Comment #24
pifagor commentedDone
Comment #25
pifagor commented