Search Postgresql Archives

Re: coalesce seems to give strange results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Yen <richyen@xxxxxxxxxxxxxx> 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(#                    FROM pg_stat_activity
| tim(#                    WHERE current_query = '<IDLE> in transaction'),
| tim(#                 0);
|  coalesce
| ----------
|         0
| (1 Zeile)

| tim=#

> sorry for the spam.
> [...]

That wasn't spam :-).

Tim


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux