Re: GROUP BY using tablename.* does not work if tablename has 1 column with NULL values

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Narayanan Iyer <nars(at)yottadb(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, support(at)yottadb(dot)com
Subject: Re: GROUP BY using tablename.* does not work if tablename has 1 column with NULL values
Date: 2021-10-08 16:22:31
Message-ID: CA+bJJbx248DEvd9Mt83X0p_eHp3t_JPSMxvJE3e+coOJfn_knA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 8 Oct 2021 at 17:54, Narayanan Iyer <nars(at)yottadb(dot)com> wrote:
> In the below example, t1 points to a table with just 1 column (lastName) and so I expect the 2 SELECT queries (pasted below) using t1.lastName or t1.* syntax to produce the exact same results. But the latter produces one extra row of output (3 rows vs 2 rows).

Given your inner query select three single value rows, one of them is
null, and https://www.postgresql.org/docs/13/functions-aggregate.html
says:

count ( * ) → bigint Computes the number of input rows.
count ( "any" ) → bigint Computes the number of input rows in which
the input value is not null.

It does not seem like a bug ( * does not mean the same everywhere ).
It maybe a missfeature or a missinterpretation of the std, but given
how careful developers are on this one I highly doubt it, I would vote
for erroneous expectations.

Francisco Olarte.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-10-08 16:35:01 Re: GROUP BY using tablename.* does not work if tablename has 1 column with NULL values
Previous Message Jeff Janes 2021-10-08 16:03:23 Re: PostgreSQL 12 Authentication type questions.