The following issue has been RESOLVED. 
====================================================================== 
http://www.dbmail.org/mantis/view.php?id=804 
====================================================================== 
Reported By:                cloos
Assigned To:                
====================================================================== 
Project:                    DBMail
Issue ID:                   804
Category:                   IMAP daemon
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     resolved
target:                      
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             09-Sep-09 00:43 CEST
Last Modified:              07-Oct-09 13:47 CEST
====================================================================== 
Summary:                    IMAP STATUS folder (UNSEEN) fails when using
postgresql 8.4
Description: 
Both the 2.2 and master branches use a query which looks like this:

SELECT 'a',COUNT(*) FROM dbmail_messages WHERE mailbox_idnr=1 AND (status
< 3) UNION SELECT 'b',COUNT(*) FROM dbmail_messages WHERE mailbox_idnr=1
AND (status < 3) AND seen_flag=1 UNION SELECT 'c',COUNT(*) FROM
dbmail_messages WHERE mailbox_idnr=1 AND (status < 3) AND recent_flag=1;

and assume the rows will be returned in the order a, b, c.

That assumption is invalid; there is no implicit ordering, either by the
order of the sub-selects in the UNION or by the first column.

That query requires an explicit 'order by 1' to order by the first column.
====================================================================== 

---------------------------------------------------------------------- 
 (0002925) cloos (reporter) - 10-Sep-09 19:47
 http://www.dbmail.org/mantis/view.php?id=804#c2925 
---------------------------------------------------------------------- 
I pushed patches for this issue to the for-master and for-2_2 branches of:

git://people.freedesktop.org/~cloos/dbmail.git for-master
git://people.freedesktop.org/~cloos/dbmail.git for-2_2

which add the ORDER BY 1 clause to the relevant SELECT. 

---------------------------------------------------------------------- 
 (0002931) paul (administrator) - 07-Oct-09 13:47
 http://www.dbmail.org/mantis/view.php?id=804#c2931 
---------------------------------------------------------------------- 
It's been merged into my master. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
09-Sep-09 00:43  cloos          New Issue                                    
09-Sep-09 00:43  cloos          File Added: order-by.patch                    
10-Sep-09 19:47  cloos          Note Added: 0002925                          
07-Oct-09 13:47  paul           Note Added: 0002931                          
07-Oct-09 13:47  paul           Status                   new => resolved     
07-Oct-09 13:47  paul           Resolution               open => fixed       
======================================================================

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev

Reply via email to