coalesce seems to give strange results

From: Richard Yen <richyen(at)iparadigms(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: coalesce seems to give strange results
Date: 2010-07-14 23:52:25
Message-ID: C3F3AF06-3F31-4229-948A-5D67A7E4CEA3@iparadigms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 = '<IDLE> in transaction';
> coalesce
> ----------
> (0 rows)
>
> postgres=# select version();
> version
> -------------------------------------------------------------------------------------------------------------------
> PostgreSQL 8.4.2 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44), 64-bit
> (1 row)

Any ideas?
--Richard

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2010-07-15 00:12:07 Re: coalesce seems to give strange results
Previous Message Joe Conway 2010-07-14 23:37:39 San Diego PostgreSQL Users Group - first meeting scheduled