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

optbuilder: relax a check for SQL routines calling SPs with OUT params #122936

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

yuzefovich
Copy link
Member

This commit relaxes the check that we have for prohibiting SQL routines to call SPs with OUT parameters. In particular, it's ok for a SQL routine to call a PLpgSQL routine that calls an SP with OUT parameters.

Fixes: #122268.

Release note: None

@yuzefovich yuzefovich added the backport-24.1.x Flags PRs that need to be backported to 24.1. label Apr 23, 2024
@yuzefovich yuzefovich requested review from DrewKimball and a team April 23, 2024 21:48
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)


pkg/sql/logictest/testdata/logic_test/procedure line 436 at r1 (raw file):

skipif config local-mixed-23.2
statement error pgcode 0A000 calling procedures with output arguments is not supported in SQL functions
CREATE PROCEDURE p_outer(OUT param INTEGER) AS $$ CALL p_inner(NULL); $$ LANGUAGE SQL;

Could you add a test with an INOUT parameter as well?


pkg/sql/logictest/testdata/logic_test/procedure line 447 at r1 (raw file):

    RAISE NOTICE 'a: %', a;
  END
$$ LANGUAGE PLpgSQL;

Did we make it so that PL/pgSQL can be used in non-ccl tests?

Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball)


pkg/sql/logictest/testdata/logic_test/procedure line 436 at r1 (raw file):

Previously, DrewKimball (Drew Kimball) wrote…

Could you add a test with an INOUT parameter as well?

Done.


pkg/sql/logictest/testdata/logic_test/procedure line 447 at r1 (raw file):

Previously, DrewKimball (Drew Kimball) wrote…

Did we make it so that PL/pgSQL can be used in non-ccl tests?

Good catch, I didn't realize this was non-ccl file (I locally ran only ccl version and it passed :) ).

@craig
Copy link
Contributor

craig bot commented Apr 24, 2024

Build failed:

This commit relaxes the check that we have for prohibiting SQL routines
to call SPs with OUT parameters. In particular, it's ok for a SQL
routine to call a PLpgSQL routine that calls an SP with OUT parameters.

Release note: None
@yuzefovich
Copy link
Member Author

One skip for local-mixed-23.2 config was missing.

bors r+

@craig craig bot merged commit 0fbef53 into cockroachdb:master Apr 24, 2024
21 of 22 checks passed
Copy link

blathers-crl bot commented Apr 24, 2024

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 1cc9910 to blathers/backport-release-24.1-122936: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 24.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-24.1.x Flags PRs that need to be backported to 24.1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: check for CALL with OUT params in SQL routine is too eager
3 participants