cockroachdb / cockroachdb/cockroach

plpgsql: plpgsql procedures don't apply the correct param ord to params

Open
#164,540 1 comment 0 reactions 1 assignee Claimed by @DrewKimball View on GitHub
A-sql-plpgsql A-sql-routine C-bug T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

When assigning the "paramOrd" to `optBuilder` scope columns allocated to represent the parameters to a PL/pgSQL routine, currently we skip over `OUT` params. This is correct for SQL, but not for PL/pgSQL routines, which are able to reference OUT params both by name and by ordinal position. For example, this test currently fails with `(42P02) no value provided for placeholder: $2`:
```
statement ok
CREATE OR REPLACE PROCEDURE p(OUT o INT, IN i INT)
AS $$ BEGIN o := $2; END; $$ LANGUAGE PLpgSQL;

query I
CALL p(NULL, 42);
----
42
```

Jira issue: CRDB-60868

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.