PostgreSQL compatibility

Created on 20 March 2025, 4 months ago

Problem/Motivation

The query in the db is not compatible with PostgreSQL

Steps to reproduce

Just enable the module having PostgreSQL as engine

Proposed resolution

Modify the query removing the quotes

💬 Support request
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain josegracia

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

Merge Requests

Comments & Activities

  • Issue created by @josegracia
  • Merge request !10Modify query in the block plugin → (Open) created by josegracia
  • Pipeline finished with Success
    4 months ago
    Total: 134s
    #453003
  • It would be a better idea to convert the query to use Drupal's database abstraction layer, with something like this:

    $query = $database->select('search_api_stats')
      ->fields('search_api_stats', ['keywords'])
      ->addExpression('COUNT(*)', 'num')
      ->condition('s_name', $serverName)
      ->condition('i_name', $indexName)
      ->condition('keywords', '', '<>')
      ->groupBy('keywords')
      ->orderBy('num', 'DESC')
      ->range(0, $config['num_phrases']);
    
    $stats = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
    
Production build 0.71.5 2024