A BUGNOTE has been added to this bug.
======================================================================
http://www.dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000181
======================================================================
Reported By:                Eduardo Stern
Assigned To:                
======================================================================
Project:                    DBMail
Bug ID:                     181
Category:                   Database layer
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             13-Mar-05 07:12 CET
Last Modified:              15-Mar-05 05:31 CET
======================================================================
Summary:                    Error in SQL using SuSE Linux 9, max value for int8 
is exceeded, PostgreSQL 8 + Postfix
Description: 
When using SuSE Linux 9, DBMAIL sends a bad insert command, with the max
value of message_idnr:

Mar 11 19:41:30 dbxslave dbmail/imap4d[3933]: dbpgsql.c, db_query: Error
executing query [SELECT seen_flag, answered_flag, deleted_flag,
flagged_flag, draft_flag, recent_flag, TO_CHAR(internal_date, 'YYYY-MM-DD
HH24:MI:SS' ), rfcsize, message_idnr FROM dbmail_messages msg,
dbmail_physmessage pm WHERE pm.id = msg.physmessage_id AND message_idnr
BETWEEN '1' AND '18446744073709551615' AND mailbox_idnr = '1' AND status <
'2' ORDER BY message_idnr ASC] : [ERROR:  value "18446744073709551615" is
out of range for type bigint ] 

======================================================================

----------------------------------------------------------------------
 paul - 13-Mar-05 07:33 CET 
----------------------------------------------------------------------
Eduardo, 

Are you perhaps using Outlook as imap client?? If so, you're probably
encountering bug 
http://www.dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000160 which 
was fixed already.

----------------------------------------------------------------------
 paul - 13-Mar-05 07:37 CET 
----------------------------------------------------------------------
Eduardo,

On second thought, the out-of-range value doesn't look like 
http://www.dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000160 after
all. Could you please include more from the logline so I can reconstruct
the command sequence that led up to the error.

Also, more details about the client used would be helpful if we are to
reproduce this one.

----------------------------------------------------------------------
 Eduardo Stern - 13-Mar-05 07:46 CET 
----------------------------------------------------------------------
No. I'm using Apple Mail. I use DBMAIL with success on a RedHat 9 system.
It only occurs in SuSE, both 9.1 and Enterprise 9.

The problem appears to be that DBMAIL is wrongly setting the maximum
values for a 64bit integer to 18446744073709551615, or  (2^64-1). 

Where is dbmail getting this value from? The max value for a 64 bit
integer, in PostgreSQL, is 9223372036854775807, or (2^63-1). This is
caused somewhere by mixing the signed and unsigned long long integers.

I have no more log messages, this is the same message that's given to me
every time. 

I made a very stupid "fix" by adding this code to db.c, just before dbmail
defines the query with the BETWEEN:

if (msg_idnr_high>9223372036854775807)
        msg_idnr_high=9223372036854775807;

----------------------------------------------------------------------
 paul - 13-Mar-05 21:44 CET 
----------------------------------------------------------------------
Eduardo,

Would you mind trying the patch on the bugtracker?

----------------------------------------------------------------------
 Eduardo Stern - 14-Mar-05 00:14 CET 
----------------------------------------------------------------------
I've installed, and it appears to work. If something arises, I will post
another bugnote.

Thank's. What was the problem?

----------------------------------------------------------------------
 Eduardo Stern - 15-Mar-05 05:31 CET 
----------------------------------------------------------------------
I've tested your patch for these two days, and it's working great. Thank's.

Bug History
Date Modified  Username       Field                    Change              
======================================================================
13-Mar-05 07:12Eduardo Stern  New Bug                                      
13-Mar-05 07:33paul           Bugnote Added: 0000606                       
13-Mar-05 07:37paul           Bugnote Added: 0000607                       
13-Mar-05 07:46Eduardo Stern  Bugnote Added: 0000608                       
13-Mar-05 21:43paul           File Added: imapcommands.diff                    
13-Mar-05 21:44paul           Bugnote Added: 0000609                       
14-Mar-05 00:14Eduardo Stern  Bugnote Added: 0000610                       
15-Mar-05 05:31Eduardo Stern  Bugnote Added: 0000612                       
======================================================================

Reply via email to