Skip site navigation (1) Skip section navigation (2)

Re: mailing list archiver chewing patches

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Matteo Beccati <php(at)beccati(dot)com>
Cc: Aidan Van Dyk <aidan(at)highrise(dot)ca>, Magnus Hagander <magnus(at)hagander(dot)net>, Dave Page <dpage(at)pgadmin(dot)org>, Abhijit Menon-Sen <ams(at)toroid(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: mailing list archiver chewing patches
Date: 2010-01-14 14:47:02
Message-ID: 87r5ps7nh5.fsf@hi-media-techno.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-www
Matteo Beccati <php(at)beccati(dot)com> writes:
> WITH RECURSIVE t (mailbox, uid, date, subject, sender, has_attachments,
> parent_uid, idx, depth) AS (
>   SELECT mailbox, uid, date, subject, sender, has_attachments, parent_uid,
> uid::text, 1
>   FROM arc_messages
>   WHERE parent_uid IS NULL AND mailbox = 15
>   UNION ALL
>   SELECT a.mailbox, a.uid, a.date, a.subject, a.sender, a.has_attachments,
> a.parent_uid, t.idx || '.' || a.uid::text, t.depth + 1
>   FROM t JOIN arc_messages a USING (mailbox)
>   WHERE t.uid = a.parent_uid
> ) SELECT * FROM t ORDER BY idx
>
> Any improvements to sorting are welcome :)

What I'd like would be to have it sorted by activity, showing first the
thread which received the later messages. I'm yet to play with CTE and
window function myself so without a database example to play with I
won't come up with a nice query, but I guess a more educated reader will
solve this without a sweat, as it looks easier than sudoku-solving,
which has been done already :)

Regards,
-- 
dim

In response to

Responses

pgsql-www by date

Next:From: Matteo BeccatiDate: 2010-01-14 15:06:33
Subject: Re: mailing list archiver chewing patches
Previous:From: Dave PageDate: 2010-01-14 14:36:35
Subject: Re: mailing list archiver chewing patches

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2010-01-14 14:53:29
Subject: Re: [PL/PgSQL] EXECUTE...USING enhancement proposal
Previous:From: Vincenzo RomanoDate: 2010-01-14 14:44:20
Subject: [PL/PgSQL] EXECUTE...USING enhancement proposal

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group