Re: coalesce seems to give strange results

Поиск
Список
Период
Сортировка
От Tim Landscheidt
Тема Re: coalesce seems to give strange results
Дата
Msg-id m38w5dgi29.fsf@passepartout.tim-landscheidt.de
обсуждение исходный текст
Ответ на coalesce seems to give strange results  (Richard Yen <richyen@iparadigms.com>)
Список pgsql-general
Richard Yen <richyen@iparadigms.com> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Vincenzo Romano
Дата:
Сообщение: Inheritance efficiency
Следующее
От: Ravi Katkar
Дата:
Сообщение: Unable to create a Postgre Datasource from windows With Database installed in RHEL 5.3