BUG #4780: Aggregate functions are unaware of LIMIT clauses in SELECTs

Поиск
Список
Период
Сортировка
От Ted Holzman
Тема BUG #4780: Aggregate functions are unaware of LIMIT clauses in SELECTs
Дата
Msg-id 200904241607.n3OG7QFR031017@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #4780: Aggregate functions are unaware of LIMIT clauses in SELECTs  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      4780
Logged by:          Ted Holzman
Email address:      tholzman@fhcrc.org
PostgreSQL version: 8.3.7
Operating system:   SuSE Linux 10.3
Description:        Aggregate functions are unaware of LIMIT clauses in
SELECTs
Details:

Hi,

I don't know if this is a bug or an arcane feature, but AGGREGATE functions
don't appear to respond to LIMIT clauses.  For example:

The untouched results of a query.

experiments=# select generate_series from generate_series(1,10);
 generate_series
-----------------
               1
               2
               3
               4
               5
               6
               7
               8
               9
              10
(10 rows)


The LIMITed results of a query.

experiments=# select generate_series from generate_series(1,10) limit 3;
 generate_series
-----------------
               1
               2
               3
(3 rows)


The SUM (aggregated) results of a limited query:


experiments=# select sum(genera
te_series) from generate_series(1,10) limit 3;
 sum
-----
  55
(1 row)

I was expecting the sum to be 6.

              ==Ted

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Thomas S. Chin"
Дата:
Сообщение: Re: BUG #4779: LIMIT/OFFSET behavior change (possibly related to Top-n)
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: BUG #4780: Aggregate functions are unaware of LIMIT clauses in SELECTs