Undefined function: function group_concat(integer) does not exist on PostgreSQL

Created on 10 September 2024, 7 months ago

Problem/Motivation

In πŸ› Database update error: Problematic GROUP BY clause Fixed , this commit introduced a GROUP_CONCAT function. This function is not available on PostgreSQL, so we are now getting an error on update:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42883]: Undefined function: 7 ERROR: function group_concat(integer) does not exist LINE 1: ...de" AS "price__currency_code", COUNT(*) AS "cnt", GROUP_CONC... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.: SELECT "cpi"."price_list_id" AS "price_list_id", "cpi"."purchasable_entity" AS "purchasable_entity", "cpi"."quantity" AS "quantity", "cpi"."price__currency_code" AS "price__currency_code", COUNT(*) AS "cnt", GROUP_CONCAT(cpi.id) AS "ids" FROM "commerce_pricelist_item" "cpi" GROUP BY "type", "price_list_id", "purchasable_entity", "quantity", "price__currency_code" HAVING (cnt > 1); Array ( ) in commerce_pricelist_update_8206() (line 205 of /modules/commerce_pricelist/commerce_pricelist.install).

See: https://database.guide/postgresql-group_concat-equivalent/

Steps to reproduce

Try to run commerce_pricelist_update_8206() on PostgreSQL

Proposed resolution

Use alternative for PostgreSQL, or remove it entirely for an universal solution.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia poker10

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

Comments & Activities

  • Issue created by @poker10
  • @poker10 opened merge request.
  • πŸ‡ΈπŸ‡°Slovakia poker10

    Created an MR with proposed fix (using another function if the db driver is PostgreSQL). Probably needs a manual testing.

Production build 0.71.5 2024