I encounter the following error when I install the webform module and go to the webform address.
1) drupal 8.6.9
2) postgres
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "*****Name webform******" LINE 5: ...') AND (entity_type = 'webform') AND (entity_id = '*-****Name webform****** ^: SELECT ge.group_id AS group_id FROM {webform_access_group_entity} ge INNER JOIN {webform_access_group_user} gu ON ge.group_id = gu.group_id WHERE (webform_id = :db_condition_placeholder_0) AND (entity_type = :db_condition_placeholder_1) AND (entity_id = :db_condition_placeholder_2) AND (uid = :db_condition_placeholder_3); Array ( [:db_condition_placeholder_0] => *****Name webform****** [:db_condition_placeholder_1] => webform [:db_condition_placeholder_2] => *****Name webform****** [:db_condition_placeholder_3] => 1 ) in Drupal\webform_access\WebformAccessGroupStorage->loadByEntities() (line 203 of /usr/share/nginx/html/drupal-test/web/modules/contrib/webform/modules/webform_access/src/WebformAccessGroupStorage.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | interdiff-3034127-13-16.txt | 3.77 KB | jrockowitz |
| #15 | 3034127-16.patch | 2.48 KB | jrockowitz |
| #13 | 3034127-13.patch | 2.21 KB | solide-echt |
Comments
Comment #2
kb_klash commentedI got an email from a customer today about the same issue. I am also using the latest version of Drupal 8 and running on a PostgreSQL database. I get the same error as detailed above.
Comment #3
jrockowitz commentedThere are 3 PostgreSQL tests that are failing. I am not running PostgreSQL locally.
This seems like a common issue. Any patch which fixes these broken tests would be appreciated.
Comment #4
kb_klash commentedI'm definitely adding this to my list of reasons why my shop should switch to MySQL instead of PostgreSQL.
Comment #5
jrockowitz commentedComment #6
jmsouney commentedI am using Drupal 8.6.10 with a PostgreSQL database and also have the same issue/error.
Comment #7
jrockowitz commentedI think
webform_query_webform_submission_access_alter()is causing this regression and someone just needs to debug the SQL query being generated.Comment #8
kb_klash commentedLooking into it a little, I was able to find that in webform_access/src/WebformAccessGroupStorage.php in the loadByEntities method, it appears that when it loads $source_entity, the id (
$source_entity->id()) is coming through as a string when the query that it gets passed to on line 184 ($query->condition('entity_id', $source_entity->id());) is expecting it to be an integer. I commented line 184 out and was able to get past the white screen of death, but I'm getting an message that says "Unable to display this webform. Please contact the site administrator." Obviously this is because it isn't loading it properly, but it is some progress.I'm going to keep looking at this but I figured this might help with the context.
Comment #9
kb_klash commentedAlso it looks like my webform_access_group_entity table is completely empty, so maybe nothing is getting in there in the first place?
Comment #10
kb_klash commentedIn webform_access.module, if I comment out line 176 which states
$webform_access_groups = $webform_access_group_storage->loadByEntities($webform, $source_entity, $account);and add a new line under it with$webform_access_groups = [];, I can actually load the page and see the form. I realize this is bypassing the access restrictions and is definitely not the real solution, but at least it gives someone smarter than me a place to look.Comment #11
jrockowitz commentedHere is my best guess for a solution.
Comment #12
jrockowitz commentedCan someone running Postgres with this issue please review the attached patch?
Comment #13
solide-echt commentedHey,
Tried it, running Postgres 9.5.3 patched against rev 649b7616 for webform module. The error persisted because the storage definition still expects an integer so simply casting will not work. Please find attached a patch including a hook_update. Please be cautioned: I have not tested this with existing data. But for me this works.
AFAIK Drupal is not completely consistent with ID's being integers or not, I've seen errors like these before with other contribs in D7. Strangely enough after adding an access group still in numeric ID is stored, not the machine name.
Greetings,
Eric
Comment #14
jrockowitz commentedThis does seem like the right direction. I will look into making sure the update hook is okay.
Comment #15
jrockowitz commentedThe attached patch includes some minor tweaks.
Comment #17
jrockowitz commentedI committed the patch. Please download the latest dev release to review.
Comment #19
gxleano commentedI get the same error, I´m using Drupal 8.7.2 with PostgreSQL.