Re: [GENERAL] coalesce seems to give strange results

2010-07-15 Thread Tim Landscheidt
Richard Yen wrote: > Ah, I see what you mean. If there's no rows to return, then there's no > coalesce-ing to do... That's right, /but/ if you use a sub-select, you can achieve something similar: | tim=# SELECT COALESCE((SELECT ROUND(EXTRACT(epoch FROM now() - query_start)) | tim(#

Re: [GENERAL] coalesce seems to give strange results

2010-07-14 Thread Richard Yen
Ah, I see what you mean. If there's no rows to return, then there's no coalesce-ing to do... sorry for the spam. --Richard On Jul 14, 2010, at 5:12 PM, Thom Brown wrote: > On 15 July 2010 00:52, Richard Yen wrote: >> Hi everyone, >> >> Looks like I'm encountering some quirks with coalesce

Re: [GENERAL] coalesce seems to give strange results

2010-07-14 Thread Thom Brown
On 15 July 2010 00:52, Richard Yen wrote: > Hi everyone, > > Looks like I'm encountering some quirks with coalesce()... > >> postgres=# select coalesce(null,0); >>  coalesce >> -- >>         0 >> (1 row) >> >> postgres=# SELECT COALESCE(ROUND(EXTRACT(epoch FROM now()-query_start)),0) >> F

[GENERAL] coalesce seems to give strange results

2010-07-14 Thread Richard Yen
Hi everyone, Looks like I'm encountering some quirks with coalesce()... > postgres=# select coalesce(null,0); > coalesce > -- > 0 > (1 row) > > postgres=# SELECT COALESCE(ROUND(EXTRACT(epoch FROM now()-query_start)),0) > FROM pg_stat_activity WHERE current_query = ' in transac