Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: DBMail: dev

dbmail 2.3.5 expunge operation select sum() failed

 

 

DBMail dev RSS feed   Index | Next | Previous | View Threaded


pwadas at jewish

May 4, 2009, 4:32 AM

Post #1 of 3 (790 views)
Permalink
dbmail 2.3.5 expunge operation select sum() failed

Hello,
dbmail 2.3.5, postgresql version is 8.3.7

Below is query, which returns invalid sum. As it is executed somewhere with
EXPUNGE operation,
reported error is "expunge failed" (see log).
Any solutions for this?

without sum aggregate, one may encounter there's 0 rows to sum returned,
while
probably numeric value is expected (?)

myserver:/var/log/dbmail# echo 'SELECT sum(pm.messagesize) FROM
dbmail_messages msg, dbmail_physmessage pm WHERE msg.physmessage_id = pm.id
AND msg.mailbox_idnr = 3 AND msg.status < 2 AND msg.deleted_flag = 1'|psql
-U username dbname
sum
-----

myserver:/var/log/dbmail# echo 'SELECT pm.messagesize FROM dbmail_messages
msg, dbmail_physmessage pm WHERE msg.physmessage_id = pm.id AND
msg.mailbox_idnr = 3 AND msg.status < 2 AND msg.deleted_flag = 1'|psql -U
username dbname
messagesize
-------------
(0 rows)

log quote:
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x80b8d70]
Debug:[MailboxState] db_acl_has_right(+524): mailbox [3] is owned by user
[1543], giving all righ
ts
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x80b8d70]
Database:[db] db_con_get(+257): [0x807a528] connection from pool
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x80b8d70]
Database:[db] db_query(+340): [0x807a528] [.SELECT sum(pm.messagesize) FROM
dbmail_messages msg, d
bmail_physmessage pm WHERE msg.physmessage_id = pm.id AND msg.mailbox_idnr =
3 AND msg.status < 2 AND msg.deleted_flag = 1]
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x80b8d70]
Database:[db] log_query_time(+290): last query took [0.001] seconds
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x80b8d70]
Error:[db] db_get_mailbox_size(+1777): SQLException:
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x80b8d70]
Database:[db] db_con_close(+275): [0x807a528] connection to pool
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x806d558]
Info:[clientbase] ci_write(+172): [0x80cae18] S > [* BYE expunge failed
]
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x806d558]
Debug:[imap] imap_handle_exit(+209): [0x80cb2e0] state [3] command_status
[1] [EXPUNGE] returned
with status [-1]
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x806d558]
Debug:[imapsession] dbmail_imap_session_set_state(+1574): state [6]
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x806d558]
Debug:[imapsession] dbmail_imap_session_set_state(+1599): [0x80cb2e0] state
[3]->[6]
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x806d558]
Debug:[imap] imap_session_bailout(+84): [0x80cb2e0] state [6]
May 04 13:19:39 MYSERVER.domain.com dbmail-imapd[20859]: [0x806d558]
Debug:[imapsession] dbmail_imap_session_delete(+139): [0x80cb2e0]

--
View this message in context: http://www.nabble.com/dbmail-2.3.5-expunge-operation-select-sum%28%29-failed-tp23366697p23366697.html
Sent from the dbmail dev mailing list archive at Nabble.com.

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev [at] dbmail
http://mailman-new.icns.fastxs.net/cgi-bin/mailman/listinfo/dbmail-dev


pwadas at jewish

May 4, 2009, 4:57 AM

Post #2 of 3 (735 views)
Permalink
Re: dbmail 2.3.5 expunge operation select sum() failed [In reply to]

Note the following from

http://www.postgresql.org/docs/8.3/static/functions-aggregate.html

"It should be noted that except for count, these functions return a null
value when no rows are selected. In particular, sum of no rows returns null,
not zero as one might expect. The coalesce function can be used to
substitute zero for null when necessary."

So probably, the query should be modified according to COALESCE description
(?)

http://www.postgresql.org/docs/8.3/static/functions-conditional.html#AEN14484

regards,
Piotr
--
View this message in context: http://www.nabble.com/dbmail-2.3.5-expunge-operation-select-sum%28%29-failed-tp23366697p23366707.html
Sent from the dbmail dev mailing list archive at Nabble.com.

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev [at] dbmail
http://mailman-new.icns.fastxs.net/cgi-bin/mailman/listinfo/dbmail-dev


paul at nfg

May 4, 2009, 5:48 AM

Post #3 of 3 (736 views)
Permalink
Re: dbmail 2.3.5 expunge operation select sum() failed [In reply to]

Piotr Wadas wrote:
>
> Note the following from
>
> http://www.postgresql.org/docs/8.3/static/functions-aggregate.html
>
> "It should be noted that except for count, these functions return a null
> value when no rows are selected. In particular, sum of no rows returns null,
> not zero as one might expect. The coalesce function can be used to
> substitute zero for null when necessary."
>
> So probably, the query should be modified according to COALESCE description
> (?)

Yep.

--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev [at] dbmail
http://mailman-new.icns.fastxs.net/cgi-bin/mailman/listinfo/dbmail-dev

DBMail dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.