Mailing List Archive

dbpgsql.c
Hello,

I tried today the imap server, and I saw that the messages couldn't be
deleted (or trashed), because there was a bad SQL command:
May 15 11:53:00 calimero dbmail/imap4d[1937]: db_query(): executing
query [.SELECT SUM(messagesize) FROM messages WHERE mailbox_idnr IN
(SELECT mailbox_idnr FROM mailboxes WHERE owner_idnr = 1::bigint) AND
m.status < 2]
May 15 11:53:00 calimero dbmail/imap4d[1937]: db_query(): Error
executing query [] : [ERROR: Relation "m" does not exist ]

In the file dbpgsql.c I replaced, line 161, m.status by messages.status
and it worked.

Is it the good solution, or did I made a mistake ?

OS: FreeBSD 5.0/i486
dbmail: Last CVS version
--
F.C.
Re: dbpgsql.c [ In reply to ]
Francois Cattin writes:

> Hello,
>
> I tried today the imap server, and I saw that the messages couldn't be
> deleted (or trashed), because there was a bad SQL command:
> May 15 11:53:00 calimero dbmail/imap4d[1937]: db_query(): executing query
> [.SELECT SUM(messagesize) FROM messages WHERE mailbox_idnr IN (SELECT
> mailbox_idnr FROM mailboxes WHERE owner_idnr = 1::bigint) AND m.status <
> 2]

yes, that's wrong, it's also missing in dbmail-1.1 (just checked it)
it's the db_get_quotum_used() functions, 1st sql statement.
actually the right one should be
<sql>
SELECT SUM(messagesize) FROM messages WHERE mailbox_idnr IN (SELECT
mailbox_idnr FROM mailboxes WHERE owner_idnr = 1::bigint) AND status <
2]
</sql>
since status is part ot messages{} table or 'SELECT SUM(messagesize),
m.status"...." m.status < 2"

havent checked for more.

HTH
cheers,