Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Started seeing this error during a migration from Postgresql using a source migration.
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: ""
LINE 4: WHERE (map.sourceid1 = '')
^: SELECT map.destid1 AS destid1
FROM
{migrate_map_files} map
WHERE (map.sourceid1 = :db_condition_placeholder_0) ; Array
(
[:db_condition_placeholder_0] =>
)
in MigrateSQLMap->lookupDestinationID() (line 315 of /.../modules/contrib/migrate/plugins/sources/sqlmap.inc).
Drush command terminated abnormally due to an unrecoverable error.
I traced it back to the $source_key
structure looking like this:
array(0 => NULL)
In mysql querying an int field with myfield = ''
works fine, in postgres it throws an error, which in turn throws an exception.
The attached patch resolves the issue in my testing.
Comment | File | Size | Author |
---|---|---|---|
#5 | strict_type_error_in_postgres-2157933-5.patch | 603 bytes | Gold |
Comments
Comment #1
jhedstromPatch above apparently fatal errors in php 5.3, looking into that now.
Comment #2
jhedstromAlso, based on the logic immediately above where the patch was, this should have already been skipping these.
Comment #3
Gold@jhedstrom, is this still an issue for you? I'm experiencing the same problem and have a similar environment. Will pick this up now too...
Comment #4
jhedstrom@Gold I don't recall how we worked around this unfortunately.
Comment #5
GoldGot it sorted. PHP5.3 doesn't like the output from array_unique() being passed straight into empty().
The following gets past that and allows the process to complete on a postgresql based site.
Comment #7
mikeryanCommitted, thanks!
Comment #8
mikeryan