I'm getting this error in SQL Server 2008:
PDOException: SQLSTATE[22018]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting the nvarchar value 'full_html' to data type int.: SELECT entity_id, pathauto FROM {pathauto_persist} WHERE entity_type = :entity_type AND entity_id IN (:entity_ids_0, :entity_ids_1); Array ( [:entity_type] => wysiwyg_profile [:entity_ids_0] => filtered_html [:entity_ids_1] => full_html ) in pathauto_persist_entity_state_load_multiple() (line 66 of path-to-module\pathauto_persist.module).
This is kinda-sorta related to this problem: #1003788: PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID
Anyhow, we can't be guaranteed that entity IDs will be integers, so the entity ID column in the pathauto_persist table needs to be varchar.
Comment | File | Size | Author |
---|---|---|---|
#6 | pathauto_persist-non_integer_entity_ids-2047811-6.patch | 805 bytes | azinck |
#4 | pathauto_persist-non_integer_entity_ids-2047811-4.patch | 684 bytes | azinck |
#1 | pathauto_persist-non_integer_entity_ids-2047811-1.patch | 1008 bytes | azinck |
Comments
Comment #1
azinck CreditAttribution: azinck commentedComment #2
Dave ReidWe could just instead do a filter on the array IDs using is_numeric() rather than having to convert a nicely performing int primary key field into a varchar.
Comment #3
azinck CreditAttribution: azinck commentedThanks for the response, Dave. Do we know that no entities with non-integer IDs will ever need to use Pathauto?
Comment #4
azinck CreditAttribution: azinck commentedPatch per Dave's suggestion in #2
Comment #5
azinck CreditAttribution: azinck commentedComment #6
azinck CreditAttribution: azinck commentedPrevious patch fails if array ends up empty after filtering.
Comment #7
torpy CreditAttribution: torpy commentedThe patch in #6 doesn't work for me:
PDOException: SQLSTATE[22018]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting the nvarchar value 'plain_text' to data type int.: SELECT entity_id, pathauto FROM {pathauto_persist} WHERE entity_type = :entity_type AND entity_id IN (:entity_ids_0, :entity_ids_1, :entity_ids_2); Array ( [:entity_type] => wysiwyg_profile [:entity_ids_0] => filtered_html [:entity_ids_1] => full_html [:entity_ids_2] => plain_text ) in pathauto_persist_entity_state_load_multiple() (line 70 of <snip>\pathauto_persist\pathauto_persist.module).
Comment #8
torpy CreditAttribution: torpy commentedActually, never mind, I did something stupid when applying the patch. My apologies, it works :)
Comment #9
Fabianx CreditAttribution: Fabianx commentedRTBC, works great!
Comment #10
stefan.r CreditAttribution: stefan.r commentedThere is patch (D8 backport) in #1003788: PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID which solves this in Drupal 7 Core and needs review...
Comment #11
heddnIs this now a non-issue since #1003788: PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID just got committed?
Comment #12
Dave ReidAgreed, I don't think we need to add this in now. I believe this would also be solved by #2476393: Performance issue since we wouldn't be attempting to query for anything that doesn't have records in the pathauto_persist table.