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

Prepared statement results in INTERVAL type #8500

Closed
1 task done
NMAC427 opened this issue Aug 7, 2023 · 2 comments · Fixed by #9814
Closed
1 task done

Prepared statement results in INTERVAL type #8500

NMAC427 opened this issue Aug 7, 2023 · 2 comments · Fixed by #9814

Comments

@NMAC427
Copy link

NMAC427 commented Aug 7, 2023

What happens?

A prepared statement containing (? / x) where x is an integer results in an expression of type INTERVAL.

To Reproduce

PREPARE S1 AS SELECT (? / 1) + 1;

Results in:

Binder Error: No function matches the given name and argument types '+(INTERVAL, INTEGER)'. You might need to add explicit type casts.
        Candidate functions:
        +(TINYINT) -> TINYINT
        +(TINYINT, TINYINT) -> TINYINT
        +(SMALLINT) -> SMALLINT
        +(SMALLINT, SMALLINT) -> SMALLINT
        +(INTEGER) -> INTEGER
        +(INTEGER, INTEGER) -> INTEGER
        +(BIGINT) -> BIGINT
        +(BIGINT, BIGINT) -> BIGINT
        +(HUGEINT) -> HUGEINT
        +(HUGEINT, HUGEINT) -> HUGEINT
        +(FLOAT) -> FLOAT
        +(FLOAT, FLOAT) -> FLOAT
        +(DOUBLE) -> DOUBLE
        +(DOUBLE, DOUBLE) -> DOUBLE
        +(DECIMAL) -> DECIMAL
        +(DECIMAL, DECIMAL) -> DECIMAL
        +(UTINYINT) -> UTINYINT
        +(UTINYINT, UTINYINT) -> UTINYINT
        +(USMALLINT) -> USMALLINT
        +(USMALLINT, USMALLINT) -> USMALLINT
        +(UINTEGER) -> UINTEGER
        +(UINTEGER, UINTEGER) -> UINTEGER
        +(UBIGINT) -> UBIGINT
        +(UBIGINT, UBIGINT) -> UBIGINT
        +(DATE, INTEGER) -> DATE
        +(INTEGER, DATE) -> DATE
        +(INTERVAL, INTERVAL) -> INTERVAL
        +(DATE, INTERVAL) -> DATE
        +(INTERVAL, DATE) -> DATE
        +(TIME, INTERVAL) -> TIME
        +(INTERVAL, TIME) -> TIME
        +(TIMESTAMP, INTERVAL) -> TIMESTAMP
        +(INTERVAL, TIMESTAMP) -> TIMESTAMP
        +(TIME, DATE) -> TIMESTAMP
        +(DATE, TIME) -> TIMESTAMP
        +(ANY[], ANY[]) -> ANY[]

OS:

macOS aarch64

DuckDB Version:

0.8.1 and v0.8.2-dev1781

DuckDB Client:

Python and shell.duckdb.org

Full Name:

Nicolas Camenisch

Affiliation:

None

Have you tried this on the latest master branch?

I have not tested with any build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have
@NMAC427
Copy link
Author

NMAC427 commented Aug 7, 2023

However, if you explicitly cast the parameter to a different type, the query succeeds.

PREPARE S1 AS SELECT (CAST(? as INTEGER) / 1) + 1;

Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Nov 22, 2023
Mytherin added a commit to Mytherin/duckdb that referenced this issue Nov 27, 2023
…ion with a parameter we rebind during execution
Mytherin added a commit that referenced this issue Nov 27, 2023
Fix #8500 - if we encounter any ambiguity while binding a function with a parameter we rebind during execution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants