
Follow up to PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID.
In comment #256 @soyarma was right, the revision id needs to be cleaned as well. I came across this issue with the webform module. The error in watchdog was:
PDOException: SQLSTATE[22018]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Conversion failed when converting the varchar value 'configure' to data type int.: SELECT revision.[vid] AS [vid], base.[uid] AS [uid], revision.[title] AS [title], revision.[log] AS [log], revision.[status] AS [status], revision.[comment] AS [comment], revision.[promote] AS [promote], revision.[sticky] AS [sticky], revision.[vuuid] AS [vuuid], revision.[ds_switch] AS [ds_switch], base.[nid] AS [nid], base.[type] AS [type], base.[language] AS [language], base.[created] AS [created], base.[changed] AS [changed], base.[tnid] AS [tnid], base.[translate] AS [translate], base.[uuid] AS [uuid], revision.[timestamp] AS [revision_timestamp], revision.[uid] AS [revision_uid] FROM node base INNER JOIN node_revision revision ON revision.nid = base.nid AND revision.vid = :revisionId WHERE ( ([base].[nid] IN (:db_condition_placeholder_0)) ); Array ( [:db_condition_placeholder_0] => 86475 [:revisionId] => configure ) in DrupalDefaultEntityController->load() (line 198 of E:\KDN\includes\entity.inc).
Unfortunately the patch at #16 is not resolving it.
Comment | File | Size | Author |
---|---|---|---|
#16 | pdoexception-2732621-16.patch | 3.08 KB | willzyx |
Comments
Comment #2
jordanrussellsmith CreditAttribution: jordanrussellsmith commentedHere is a patch for D7 that solved the issue for me.
BTW its my first patch on drupal.org so go easy on me ;)
Comment #4
jordanrussellsmith CreditAttribution: jordanrussellsmith commentedCan someone offer some insight on how to get these tests to pass?
Thanks,
Jordan
Comment #5
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThanks for the patch!
If you click through on the failed test results it will take you to a page with more details (in this case https://www.drupal.org/pift-ci-job/299059) which can help give information about why the test is failing.
In this case it looks like most of the failures are the following:
From looking at the patch, I think a likely cause of this is that the cleanIds() method expects to be passed an array, but it isn't getting one from the new code added here?
Comment #6
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedBy the way, this issue might also need to be moved to Drupal 8 and fixed there first (at least if #1003788-256: PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID is correct that this affects Drupal 8 too; I haven't checked myself).
Comment #7
jordanrussellsmith CreditAttribution: jordanrussellsmith commentedI added $revision_id to a new array $revision_ids to try to get the tests to pass...
Comment #8
jordanrussellsmith CreditAttribution: jordanrussellsmith commentedComment #9
willzyx CreditAttribution: willzyx commentedrerolled
Comment #10
willzyx CreditAttribution: willzyx commentedmmm place this check in
DrupalDefaultEntityController::cleanId()
not seems correct to me. I think that we need a separate method for check the revision id validity or otherwise the validation logic could be incorrect.. we risk to check revision id validity using the base table id definition (and vice versa)Also probably is worth to check revision id validity also in
DrupalDefaultEntityController::buildQuery()
that is called directly by the subclassesComment #11
willzyx CreditAttribution: willzyx commentedand the interdiff
Comment #12
willzyx CreditAttribution: willzyx commentedehmm and the real interdiff :)
Comment #13
willzyx CreditAttribution: willzyx commentedrerolled
Comment #15
joseph.olstadtestbot is fixed
Comment #16
willzyx CreditAttribution: willzyx commentedrerolled
Comment #17
featherbellyI get a similar error when adding a webform component using PostgreSQL — the
revisionId
is being set ascomponents
.PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "components" LINE 4: ...ion ON revision.nid = base.nid AND revision.vid = 'component... ^: SELECT revision.vid AS vid, base.uid AS uid, revision.title AS title, revision.log AS log, revision.status AS status, revision.comment AS comment, revision.promote AS promote, revision.sticky AS sticky, revision.vuuid AS vuuid, revision.ds_switch AS ds_switch, base.nid AS nid, base.type AS type, base.language AS language, base.created AS created, base.changed AS changed, base.tnid AS tnid, base.translate AS translate, base.uuid AS uuid, revision.timestamp AS revision_timestamp, revision.uid AS revision_uid FROM {node} base INNER JOIN {node_revision} revision ON revision.nid = base.nid AND revision.vid = :revisionId WHERE (base.nid IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => 126598 [:revisionId] => components ) in DrupalDefaultEntityController->load() (line 198 of /var/www/html/includes/entity.inc).
The patch at #16 does not solve this.
if (isset($entity_info['revision table field types'])) { ... }
returnsnull
in this instance.Comment #18
featherbellySorry ignore me — didn't
drush cc all
. School boy error :-0Patch works!
Comment #19
featherbellyComment #20
featherbelly