Drupal Core update 9.5.3 results in broken response

Created on 2 February 2023, over 1 year ago
Updated 11 February 2023, over 1 year ago

Problem/Motivation

Running into the following error when going to the oai/request?verb=ListRecords&metadataPrefix=oai_dc url.

"The website encountered an unexpected error. Please try again later."

Further, the following error message is in the logs:

"Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'r.entity_idr.entity_type' in 'group statement': SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM "rest_oai_pmh_record" "r" INNER JOIN "rest_oai_pmh_member" "m" ON m.entity_id = r.entity_id AND m.entity_type = r.entity_type INNER JOIN "rest_oai_pmh_set" "s" ON s.set_id = m.set_id GROUP BY "r"."entity_idr"."entity_type") "subquery"; Array ( ) in Drupal\rest_oai_pmh\Plugin\rest\resource\OaiPmh->getRecordIds() (line 531 of /var/www/drupal/web/modules/contrib/rest_oai_pmh/src/Plugin/rest/resource/OaiPmh.php)."

Steps to reproduce

This seems to be an issue when you update the Drupal core to 9.5.3.

Proposed resolution

Seems to be an issue related to the group by syntax. May have been caused by this https://git.drupalcode.org/project/drupal/-/commit/b9b6fa58648511a957d3d... !

As per here https://drupal.stackexchange.com/questions/66807/building-a-query-with-t...

converting the following line 503
$query->groupBy('r.entity_id, r.entity_type');
to
$query->groupBy('r.entity_id')->groupBy('r.entity_type');

seems to fix the issue.

Remaining tasks

Review and testing !

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇦Canada Natkeeran

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Natkeeran
  • First commit to issue fork.
  • @ultrabob opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇯🇵Japan ultrabob Japan

    Thanks @Natkeeran for tracking that down! I've made the same change on our codebase when we had the same issue, and that fixed it. I've created a merge request, and I'm now attaching a patch of the change.

  • Status changed to RTBC over 1 year ago
  • 🇫🇮Finland aleksip Finland

    Came up with the same problem and the same fix. Tested the patch in #4 and can confirm that the error no longer occurs.

  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States joecorall

    Thanks, everyone! Just cut a new release with this fix.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024