Problem/Motivation

Improve query to support the other db drivers included in core.

Steps to reproduce

Install this module on a Drupal 10 setup with PostgreSQL 12+

Proposed resolution

See patch

Remaining tasks

Commit the patch and tag a new release

User interface changes

N/A

API changes

Minor

Data model changes

N/A

CommentFileSizeAuthor
#2 3444012-02.patch544 bytesjoseph.olstad

Comments

joseph.olstad created an issue. See original summary.

joseph.olstad’s picture

StatusFileSize
new544 bytes
joseph.olstad’s picture

Status: Active » Reviewed & tested by the community
joseph.olstad’s picture

Assigned: joseph.olstad » Unassigned
uccio’s picture

HI,

Thanks for the report.

I quickly tried the module with 10.2.5 and SQlite but I don't encounter any problems.

What problems do you have with postgres?

The query is objectively not beautiful but it should still work...

joseph.olstad’s picture

I needed this patch with PostgreSQL 12
it should still work with mysql /mariadb and sqlite

  • b90ba1c5 committed on 8.x-1.x
    Issue #3444012 by joseph.olstad: Compatibility with PostgreSQL and...
uccio’s picture

Assigned: Unassigned » uccio
Status: Reviewed & tested by the community » Fixed

HI,

I replicated the problem with PostgreSQL:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42P10]: Invalid column reference: 7 ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list LINE 5: ORDER by b.weight ^: SELECT DISTINCT * FROM "book" as b inner join "node" as n ON n.nid = b.nid WHERE b.pid = :pid ORDER by b.weight; Array ( [:pid] => 1 ) in Drupal\booktree\Controller\BooktreeController->booktree_mostra_figli() (line 69 of /var/www/html/booktree-pgsql/web/modules/contrib/booktree/src/Controller/BooktreeController.php).

the patch fixes it.
Thank you

I apply the fix to both branches 8.x-1.x and 3.x

joseph.olstad’s picture

Thanks Uccio!

Status: Fixed » Closed (fixed)

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