function rsvp_function_load_guests creating invalid SQL for PostgreSQL

sbuttgereit - October 25, 2009 - 05:59
Project:RSVP
Version:6.x-2.0-rc3
Component:Code
Category:bug report
Priority:normal
Assigned:ulf1
Status:closed
Description

In the file rsvp.functions.inc, function rsvp_function_load_guests, lines 403 & 406 the queries being generated don't work with PostgreSQL (version 8.4.1). The query being generated is (one example):

SELECT SUM(totalguests)
FROM rsvp r LEFT JOIN rsvp_invite u ON r.rid = u.rid
            LEFT JOIN users us ON u.uid = us.uid
            LEFT JOIN rsvp_realname n ON u.email = n.email 
WHERE u.rid = 1 AND u.response='none'
ORDER BY u.email

PostgreSQL chokes on the 'ORDER BY' clause with the error:

Query failed: ERROR: column "u.email" must appear in the GROUP BY clause or be used in an aggregate function

This is because in the context of a single, global aggregate of all results the order by is contradictory. If you're going to sort by email, you need to have some distinction by email or what is the purpose of the sort, right?

#1

ulf1 - October 27, 2009 - 18:33
Assigned to:Anonymous» ulf1
Status:active» fixed

Thanks for reporting.

The next dev version contains the bugfix

~
Ulf

#2

System Message - November 10, 2009 - 18:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.