In PostgreSQL 18, a group of three rows holds v values 1, NULL and 2. What do avg(v) and sum(v) return for that group?
Explanation
Both aggregates ignore the null: sum adds 1 and 2, and avg divides that 3 by 2 rather than by 3. Answering 1 and 3 assumes the null contributes a row to the divisor, which is what sum(v) / count(*) would compute.