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

Any stored procedure is not working #411

Open
2 tasks done
zhousun opened this issue Nov 9, 2024 · 1 comment
Open
2 tasks done

Any stored procedure is not working #411

zhousun opened this issue Nov 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@zhousun
Copy link

zhousun commented Nov 9, 2024

What happens?

Stored procedure will run each query with more parameters, thus will always hit assert in duckdb.

To Reproduce

postgres=# create table t(a int);
CREATE TABLE
postgres=# SET duckdb.force_execution TO true;
SET
postgres=# CREATE OR REPLACE PROCEDURE t(b INT)
LANGUAGE plpgsql
AS $$
BEGIN
    select * from t where a=b;
END;
$$;
CREATE PROCEDURE
postgres=# call t(1);
ERROR:  (PGDuckDB/Duckdb_ExecCustomScan) Invalid Input Error: Parameter argument/count mismatch, identifiers of the excess parameters: 2
CONTEXT:  SQL statement "select * from t where a=b"
PL/pgSQL function t(integer) line 3 at SQL statement

OS:

MacOs

pg_duckdb Version:

0.1.0

Postgres Version:

16

Hardware:

No response

Full Name:

Zhou

Affiliation:

Mooncake Labs

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?

  • Yes, I have
@zhousun
Copy link
Author

zhousun commented Nov 9, 2024

I would suggest following fix:
simply populate prepared->named_param_map with all parameters

@JelteF JelteF added the bug Something isn't working label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants