That works on postgresql, but if that looks like dbmail-1.x, how'd it end up on 
the CVS version of dbmail? I checked out the source just a minute ago and sure 
enough, it has the bad query in it.

On Fri, Apr 02, 2004 at 08:08:21PM +0200, Paul J Stevens wrote:
> Paul F. De La Cruz wrote:
> >in dbsearch.c (line 359): snprintf(query, DEF_QUERYSIZE, "SELECT
> >messageblk FROM messageblks " "WHERE message_idnr = '%llu' " "ORDER
> >BY messageblk_idnr", msg_idnr);
> >
> >yet there is _no_ message_idnr in the messageblks table! did the
> >messages table get left out of the FROM clause accidentally? changing
> >'FROM messageblks' to 'FROM messageblks,messages' seems to make the
> >query work, but I'm wondering how that query might have ended up the
> >way it is?
> 
> Smells like dbmail-1.x to me. Now the physmessage table has been 
> inserted between messages and messageblks. So you probably need 
> something like:
> 
> snprintf(query, DEF_QUERYSIZE,
>       "SELECT messageblk FROM messageblks"
>       "LEFT JOIN messages ON "
>       "messages.physmessage_id=messageblks.physmessage_id "
>       "WHERE messages.message_idnr = '%llu' "
>       "ORDER BY messageblk_idnr", msg_idnr);
> 
> Will this work for postgresql ? Looks like ansi sql to me, but I'm not sure.

Reply via email to