Qualified count star over asymmetric join miscounts
Author: tjmcewanCreated Sep 5, 2025Updated Sep 17, 2026
Labelsreproduced
What happens?
A qualified count_star over an asymmetric join will include an erroneous count where there are no matching rows from the joined table.
To Reproduce
create table a (id int4);
create table b (id int4);
insert into a (id) values (1), (2), (3);
insert into b (id) values (2), (3), (3);
select a.id
, count(*)
, count(a.*) as a_star
, count(b.*) as b_star
, count(b.id) as b_id
from a
left join b on a.id = b.id
group by a.id
;The last two columns should be equal; the b_star column is erroneous.
OS:
macos
DuckDB Version:
DuckDB v1.4.0-dev3790 (Development Version) 879df8212b
DuckDB Client:
duckdb cli
Hardware:
No response
Full Name:
Tim McEwan
Affiliation:
Climate Risk
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a nightly build
Did you include all relevant data sets for reproducing the issue?
Yes
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
- Yes, I have
Source: duckdb/duckdb