Re: BUG #11642: Aggregate Functions like min, max return one row in case of no rows in table

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: jai(dot)soni(at)elbizsystems(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11642: Aggregate Functions like min, max return one row in case of no rows in table
Date: 2014-10-11 09:14:35
Message-ID: 5438F4FB.9060108@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 10/11/14, 9:31 AM, jai(dot)soni(at)elbizsystems(dot)com wrote:
> Aggregate Functions like min, max return one row in case of no rows in table
> it should return 0 rows as it return while using normal field in select
> query

According to whom?

This behaviour is well defined in the SQL standard and documented for
example here:
http://www.postgresql.org/docs/9.3/static/sql-select.html#SQL-GROUPBY

"Aggregate functions, if any are used, are computed across all rows
making up each group, producing a separate value for each group (whereas
without GROUP BY, an aggregate produces a single value computed across
all the selected rows)."

.marko

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Inoue, Hiroshi 2014-10-11 09:19:24 Re: [BUGS] BUG #11608: ODBC driver crashes after wrong password entered
Previous Message jai.soni 2014-10-11 07:31:09 BUG #11642: Aggregate Functions like min, max return one row in case of no rows in table