Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: no builtin aggregate for SUM_INT on [unknown] #83874

Closed
bajinsheng opened this issue Jul 6, 2022 · 4 comments
Closed

ERROR: no builtin aggregate for SUM_INT on [unknown] #83874

bajinsheng opened this issue Jul 6, 2022 · 4 comments
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-sql-queries SQL Queries Team
Projects

Comments

@bajinsheng
Copy link

bajinsheng commented Jul 6, 2022

Describe the problem

An error was encountered when using NULL in sum_int function.

To Reproduce

SELECT sum_int(NULL+1); --ERROR: no builtin aggregate for SUM_INT on [unknown]

Expected behavior
No error.

Additional data / screenshots

Environment:

  • CockroachDB version [02dcb38]
  • Server OS: [Ubuntu 20.04]
  • Client app [cockroach sql]

Additional context

Jira issue: CRDB-17325

@bajinsheng bajinsheng added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Jul 6, 2022
@blathers-crl
Copy link

blathers-crl bot commented Jul 6, 2022

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I was unable to automatically find someone to ping.

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-untriaged blathers was unable to find an owner labels Jul 6, 2022
@yuzefovich yuzefovich removed the X-blathers-untriaged blathers was unable to find an owner label Jul 6, 2022
@yuzefovich yuzefovich added this to Triage in SQL Queries via automation Jul 6, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Jul 6, 2022
@mgartner
Copy link
Collaborator

mgartner commented Jul 6, 2022

To start, we should probably make the error match that of sum:

defaultdb> select sum(NULL+1);
ERROR: ambiguous call: sum(unknown), candidates are:
sum(float) -> float
sum(decimal) -> decimal
sum(interval) -> interval
sum(int) -> decimal
SQLSTATE: 42725

Ideally, sum_int wouldn't exist. It's only necessary because sum(int) returns a decimal rather than an integer.

@mgartner mgartner moved this from Triage to Backlog in SQL Queries Jul 6, 2022
Copy link

github-actions bot commented Jan 1, 2024

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@mgartner
Copy link
Collaborator

mgartner commented Jan 2, 2024

To start, we should probably make the error match that of sum:

I don't think this last comment of mine is quite right. It won't have the same error message because there is only one overload for sum_int.

To match Postgres's behavior here, we need to match Postgres's function resolution logic, which is tracked in #75101. I'm going to close this as a duplicate of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-sql-queries SQL Queries Team
Projects
Archived in project
SQL Queries
Backlog (DO NOT ADD NEW ISSUES)
Development

No branches or pull requests

3 participants