Re: BUG #15208: COALESCE with CTE returns NULL - Mailing list pgsql-bugs

From Sergei Kornilov
Subject Re: BUG #15208: COALESCE with CTE returns NULL
Date
Msg-id 494321527265482@myt2-66bcb87429e6.qloud-c.yandex.net
Whole thread Raw
In response to BUG #15208: COALESCE with CTE returns NULL  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
Hello
I can not reproduce

psql (10.4 (Debian 10.4-1.pgdg80+1))
Type "help" for help.

postgres=# WITH test_cte AS (SELECT 1 AS id, 2 AS qty)
SELECT COALESCE(SUM(qty), 0) FROM test_cte WHERE id=2;
 coalesce 
----------
        0
(1 row)

postgres=# WITH test_cte AS (SELECT 1 AS id, 2 AS qty)
SELECT COALESCE((SELECT SUM(qty) FROM test_cte WHERE id=2), 0);
 coalesce 
----------
        0
(1 row)

Can you give more complete example?

regards, Sergei


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15208: COALESCE with CTE returns NULL
Next
From: Tom Lane
Date:
Subject: Re: BUG #15208: COALESCE with CTE returns NULL