[pgsql-jp: 40140] count関数がis nullな行コンストラクタの値をカウントしてしまう

Aketi Jyuuzou postgresqlmailabcd @ mail.goo.ne.jp
2010年 1月 16日 (土) 10:51:27 JST


postgres=# select version();
                            version
----------------------------------------------------------------
 PostgreSQL 8.4beta2, compiled by Visual C++ build 1400, 32-bit

create table disTest(Val1,Val2) as
values(null,   1),
      (null,null);

postgres=# select row(Val1,Val2) is null
postgres-#   from disTest;
 ?column?
----------
 f
 t

postgres=# select count(row(Val1,Val2))
postgres-#   from disTest;
 count
-------
     2

****************************************************************************

http://www.postgresql.jp/document/current/html/functions-aggregate.html
count(expression)は、expressionが非NULL値を持つ入力行の個数を返すので

select count(row(Val1,Val2)) from disTest;
は2でなく1を返すと思いますが、
2を返すのが正しい仕様なのでしょうか?




pgsql-jp メーリングリストの案内