Project:Ajax Table
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

I installed the module in my PostgreSql drupal and there are error in syntax SQL.

In the Module Documentation

* warning: pg_query() [function.pg-query]: Query failed: ERROR: column "node.nid" must appear in the GROUP BY clause or be used in an aggregate function in /var/www/html/web/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT COUNT(*) FROM node ORDER BY nid DESC in /var/www/html/web/includes/database.pgsql.inc on line 144.

Thanks

Comments

#1

I also got this error.

The problem appears that the module is trying to execute the follow query

SELECT COUNT(*) FROM node ORDER BY nid DESC

on line 358 of ajaxtable.module

Which is clearly illegal SQL since there is no nid column when you COUNT something.

There needs to be no ORDER BY clause when you do a count.

Also, and I dont understand the code or why this works

$count should be defined as $count = $row['count'];

Messy Hack

starting on line 358:

  $count_query = preg_replace('/SELECT (.*) FROM/','SELECT COUNT(' . $count_inner . ') FROM',$table['query']);
  $pos_of_order = strpos($count_query, ' ORDER BY');
  if (!($pos_of_order === false)) $count_query = substr($count_query, 0, $pos_of_order);
  $result = db_query($count_query,$search_values);
  $row = db_fetch_array($result);
  $count = $row['count'];
  $elements['rows'] = $count;
nobody click here