Skip to content

Unnecessary "OVER ()" for aggregate functions #2018

@Jelenkee

Description

@Jelenkee

Hello,

from invoices
select [avg_price = avg total]

generates

SELECT
  AVG(total) OVER () AS avg_price
FROM
  invoices

This query returns the average price. But not once, but n times, where n is the number of rows in the table.
I would expect instead:

SELECT
  AVG(total) AS avg_price
FROM
  invoices

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions