Skip to content

Improve error message for function signature mismatch #6396

@2010YOUY01

Description

@2010YOUY01

Is your feature request related to a problem or challenge?

Currently the error message for not providing the correct function arguments is not straightforward:

❯ select factorial(3.0);
Error during planning: Coercion from [Float64] to the signature Uniform(1, [Int64]) failed.

Describe the solution you'd like

I like DuckDB's error message for wrong function arguments, we can adopt a similar approach to enhance the understandability of the error.

Providing candidate function signatures:

duckdb> select factorial(3.0);
Binder Error: No function matches the given name and argument types 'factorial(DECIMAL(2,1))'. You might need to add explicit type casts.
        Candidate functions:
        factorial(INTEGER) -> HUGEINT

"Did you mean" for wrong function names:

duckdb> select truncate();
Catalog Error: Scalar Function with name truncate does not exist!
Did you mean "trunc"?
LINE 1: select truncate();

The following tasks are planned to be implemented:

They're planned to be done on built-in scalar function first. Once done, it's easier to port everything into aggregate/window functions.

  • Improve error message for aggregate functions
  • Improve error message for window functions

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions