Not working with PostgreSQL

Created on 11 June 2024, 5 months ago
Updated 12 September 2024, 2 months ago

Problem/Motivation

The current implementation of certain database queries in the node_access_rebuild_progressive module uses raw SQL that is not compatible with PostgreSQL. Specifically, the LIMIT clause syntax and subqueries in the DELETE statement need to be updated to ensure compatibility across both MySQL and PostgreSQL databases.

Steps to reproduce

1. Set up a Drupal site with PostgreSQL as the database.
2. Install and enable the node_access_rebuild_progressive module.
3. Run drush node-access-rebuild-progressive
4. Observe the SQL errors related to the LIMIT clause:

SQLSTATE[42601]: Syntax error: 7 ERROR:  LIMIT #,# syntax is not supported
LINE 1: SELECT nid FROM "node" ORDER BY nid DESC LIMIT 0,1
                                                                                 ^
HINT:  Use separate LIMIT and OFFSET clauses.: SELECT nid FROM "node" ORDER BY nid DESC LIMIT 0,1;

Proposed resolution

Rewrite DB queries to use Drupal's Database API, which abstracts the differences between MySQL and PostgreSQL:

Remaining tasks

  1. Review and test the proposed code changes in a PostgreSQL environment.
  2. Ensure the changes do not affect MySQL compatibility.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡·πŸ‡ΊRussia qzmenko Novosibirsk

Live updates comments and jobs are added and updated live.
  • PostgreSQL

    Particularly affects sites running on the PostgreSQL database.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024