Problem/Motivation
In WebformSubmissionLogManager::getQuery() the database table users_field_data gets aliased to user.
Since user is a reserved term in PostgreSQL the query fails and raises an exception.
SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "."
LINE 6: ...T OUTER JOIN "users_field_data" "user" ON log.uid = user.uid
^: SELECT COUNT(*) AS "expression"
FROM
(SELECT 1 AS "expression"
FROM
"webform_submission_log" "log"
LEFT OUTER JOIN "users_field_data" "user" ON log.uid = user.uid
LEFT OUTER JOIN "webform_submission" "submission" ON log.sid = submission.sid
WHERE ("log"."webform_id" = :db_condition_placeholder_0) AND ("log"."sid" = :db_condition_placeholder_1)) "subquery";
See PostgreSQL documentation appendix for reference.
Steps to reproduce
Open route entity.webform_submission.edit_form on any submission
Proposed resolution
Rename the alias user to user_data
Remaining tasks
apply fix
User interface changes
none
API changes
none
Data model changes
none
Comments
Comment #3
guedressel commentedComment #4
guedressel commentedI've submitted this issue on the wrong module first. Please ignore the issue fork "Issue fork webform_workflows_element-3565422".
Comment #5
mably commentedWe could even shorten it to
ufd.Comment #6
cilefen commentedI had a quick and cursory look at the Webform codebase, and only at a glance, I see
users_field_databeing aliased toubut not touser.Comment #7
mably commentedHere is what I get when in do a quick search in my Drupal install:
Comment #8
cilefen commentedI overlooked WebformSubmissionLogManager in my findings. That's probably the one! It looks like a simple fix.
Comment #10
guedressel commentedSimple fix just committed to the issue fork and created a merge request. Thanks for your support.
Comment #11
guedressel commentedComment #12
mably commentedChange looks ok to me.
Comment #16
liam morlandThanks!
Comment #18
liam morland