Error in query for pgsql

Yoran - October 8, 2008 - 09:46
Project:Comment RSS
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Dave Reid
Status:closed
Description

Hello,

This version don't give any results with postgresql system.

In your query :
$SQL = 'SELECT '. $nidselector .', c.cid, c.subject, c.comment, c.timestamp, c.uid, c.name, c.format, u.name username, n.title FROM {node} n '. $joins .' INNER JOIN {comments} c ON c.nid = n.nid INNER JOIN {users} u ON c.uid = u.uid WHERE '. $where .' n.status = 1 AND c.status = %d ORDER BY c.timestamp DESC';

You should have an 'AS' keyword between 'u.name' and 'username'

Regads.

#1

Gábor Hojtsy - October 8, 2008 - 10:06

Otherwise the module works all great with pgsql?

#2

Dave Reid - November 14, 2008 - 05:01

I stole a look through the code to see if anything is wrong with that query, but everything conforms to SQL-99. However, I was a little puzzled by the following:

<?php
 
// Add passed query parameter; plus we are looking for published comments.
 
$params = isset($param) ? array($param) : array();
 
$params[] = COMMENT_PUBLISHED;

 
// Use query rewriting for node level access permission support.
 
$comments = db_query_range(db_rewrite_sql($SQL), $params, COMMENT_PUBLISHED, 0, variable_get('feed_default_items', 10));
?>

It looks like the COMMENT_PUBLISHED is included twice in the parameters passed to db_query_range and it doesn't look like there is a need for it...

#3

AlexisWilke - December 23, 2008 - 08:37
Version:6.x-2.0» 6.x-2.x-dev

Gábor Hojtsy,

Hey! This was reported on October 8 and not checked in... Why not?! I fixed that bug too and I downloaded the module only a few days ago (like less than 7) and I should have gotten the fixed version! (as I took the -dev module)

Would you mind quickly fixing this bug? The 'AS' will work just fine in MySQL and Oracle.

The rest seems to work just fine with PostgreSQL.

Thank you.
Alexis Wilke

#4

Shiny - January 15, 2009 - 23:07
Status:active» needs review

Patch attached for the missing AS.

AttachmentSize
commentrss.pages_.patch 1 KB

#5

AlexisWilke - January 16, 2009 - 01:55

Looks good to me. 8-)

Thank you.
Alexis Wilke

#6

stefanor - February 8, 2009 - 11:46
Status:needs review» reviewed & tested by the community

I just came across this again as well. Patch looks good.

SR

#7

Dave Reid - July 17, 2009 - 15:43
Assigned to:Anonymous» Dave Reid
Status:reviewed & tested by the community» fixed

Committed to 6.x-2.x and 5.x-2.x. Thanks!

#8

System Message - July 31, 2009 - 15:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.