Mailing List Archive

db_listmailboxchildren() bug (with PostgreSQL)
Hello,

today I noticed that when I rename mail folders (through IMAP) not every
sub-folder is also moved to the new location. I traced this down to a bug in
the PostgreSQL version of db_listmailboxchildren() :

The attached patch shows the relevant code (which is removed): 'row' contains
the first result returned by the query asking PostgreSQL for the sub-folders
and 'PQcounter' is initialized to 0, so the first result tuple is fetched
again. The first and second entry in the 'children' list returned by
db_listmailboxchildren() are then the same and therefore the last result
value from the query is never returned. The "first" sub-folder is renamed
twice and the "last" sub-folder is not renamed.

The patch replaces the do/while-loop with an IMHO easier to read and
understand for-loop (the "big fatal" error can not occur since *nchildren is
initialized to PQntuples(res) ).

Please apply this to CVS.

Regards,
Armin
Re: db_listmailboxchildren() bug (with PostgreSQL) [ In reply to ]
thanks, applied :-)


Armin Groesslinger heeft op dinsdag, 20 mei 2003 om 21:32
(Europe/Amsterdam) het volgende geschreven:

> Hello,
>
> today I noticed that when I rename mail folders (through IMAP) not
> every
> sub-folder is also moved to the new location. I traced this down to a
> bug in
> the PostgreSQL version of db_listmailboxchildren() :
>
> The attached patch shows the relevant code (which is removed): 'row'
> contains
> the first result returned by the query asking PostgreSQL for the
> sub-folders
> and 'PQcounter' is initialized to 0, so the first result tuple is
> fetched
> again. The first and second entry in the 'children' list returned by
> db_listmailboxchildren() are then the same and therefore the last
> result
> value from the query is never returned. The "first" sub-folder is
> renamed
> twice and the "last" sub-folder is not renamed.
>
> The patch replaces the do/while-loop with an IMHO easier to read and
> understand for-loop (the "big fatal" error can not occur since
> *nchildren is
> initialized to PQntuples(res) ).
>
> Please apply this to CVS.
>
> Regards,
> Armin
> <pg-listmailboxchildren.diff>

_________________________
R.A. Rozendaal
IC&S
T: +31 30 2322878
F: +31 30 2322305
www.ic-s.nl