pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ansley, Michael <Michael.Ansley@intec.co.za>
To: Ansley, Michael <Michael.Ansley@intec.co.za>
To: 'Michael Richards' <miker@scifair.acadiau.ca>
Cc: pgsql-sql@postgreSQL.org, hackers@postgreSQL.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: RE: [HACKERS] Counting bool flags in a complex query
Date: Fri, 16 Jul 1999 12:01:26 +0200
Message-ID: <1BF7C7482189D211B03F00805F8527F70ED04A@S-NATH-EXCH2> (raw)

Sorry guys, this line:
>> ORDER BY (if(folderid < 0) then return(abs(folderid)) else
>> return(folderid+max(abs(MIN(folderid)))))

Should have read:
ORDER BY (if(folderid < 0) then return(abs(folderid)) else
return(folderid+abs(MIN(folderid))))

The max was an error.

MikeA

>> 
>> Why don't you adjust the ids of your system folders, such 
>> that they are
>> ordered properly?  You should have a fixed number of system 
>> folders, so you
>> can guarantee the ids that they will receive.  So make the 
>> Inbox -4.  Then
>> you just order by folder id, ascending.  -4 comes first, 
>> with the user
>> folders always coming after the system folders.
>> 
>> Alternatively, you can sort by an expression, something like:
>> 
>> ORDER BY (if(folderid < 0) then return(abs(folderid)) else
>> return(folderid+max(abs(MIN(folderid)))))
>> 
>> What this does is shift all the ids up to ensure that they 
>> all fall into the
>> positive range, while inverting the order of the negative 
>> ids, which seems



view thread (12+ messages)  latest in thread

Message-ID: <1BF7C7482189D211B03F00805F8527F70ED04A@S-NATH-EXCH2>
Permalink:  ../1BF7C7482189D211B03F00805F8527F70ED04A@S-NATH-EXCH2/
Also on:    postgresql.org/message-id/1BF7C7482189D211B03F00805F8527F70ED04A@S-NATH-EXCH2

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: Michael.Ansley@intec.co.za, miker@scifair.acadiau.ca, tgl@sss.pgh.pa.us
  Subject: Re: [HACKERS] Counting bool flags in a complex query
  In-Reply-To: <1BF7C7482189D211B03F00805F8527F70ED04A@S-NATH-EXCH2>
  References: <1BF7C7482189D211B03F00805F8527F70ED04A@S-NATH-EXCH2>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox