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

sql: check for CALL with OUT params in SQL routine is too eager #122268

Closed
DrewKimball opened this issue Apr 12, 2024 · 0 comments · Fixed by #122936
Closed

sql: check for CALL with OUT params in SQL routine is too eager #122268

DrewKimball opened this issue Apr 12, 2024 · 0 comments · Fixed by #122936
Assignees
Labels
A-sql-routine UDFs and Stored Procedures C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-qa T-sql-queries SQL Queries Team

Comments

@DrewKimball
Copy link
Collaborator

DrewKimball commented Apr 12, 2024

A SQL routine cannot call a stored procedure that has OUT-params. However, it's ok for a SQL routine to call a PL/pgSQL routine that calls a procedure with OUT-params:

CREATE OR REPLACE PROCEDURE p_nested(OUT x INT) LANGUAGE SQL AS $$
  SELECT 1;
$$;
CREATE OR REPLACE PROCEDURE p_plpgsql() LANGUAGE PLpgSQL AS $$
  DECLARE
    a INT;
  BEGIN
    CALL p_nested(a);
    RAISE NOTICE 'a: %', a;
  END
$$;
CREATE OR REPLACE PROCEDURE p() LANGUAGE SQL AS $$
  CALL p_plpgsql();
$$;
CALL p();

Currently, CRDB fails with calling procedures with output arguments is not supported in SQL functions, while postgres succeeds.

Jira issue: CRDB-37784

@DrewKimball DrewKimball added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-qa T-sql-queries SQL Queries Team A-sql-routine UDFs and Stored Procedures labels Apr 12, 2024
@github-project-automation github-project-automation bot moved this to Triage in SQL Queries Apr 12, 2024
@yuzefovich yuzefovich self-assigned this Apr 23, 2024
@yuzefovich yuzefovich moved this from Triage to Active in SQL Queries Apr 23, 2024
@craig craig bot closed this as completed in 0fbef53 Apr 24, 2024
@github-project-automation github-project-automation bot moved this from Active to Done in SQL Queries Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-routine UDFs and Stored Procedures C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-qa T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants