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

release-22.2: sql: fix ambigious udf overload with null arguments #109193

Merged

Conversation

rharding6373
Copy link
Collaborator

@rharding6373 rharding6373 commented Aug 21, 2023

This change backports a small change from a larger PR (#98162) that prevents short-circuiting type checking for UDF function overloads. This allows us to do more precise type checking even if inputs are NULL.

Epic: none
Fixes: #88374

Release note (bug fix): Fixes ambiguous calls to UDFs with NULL arguments.

Release justification: Fixes a bug referencing UDF overloads.

@rharding6373 rharding6373 requested a review from a team as a code owner August 21, 2023 23:19
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator Author

@rharding6373 rharding6373 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @mgartner and @michae2)


pkg/sql/logictest/testdata/logic_test/udf line 2849 at r1 (raw file):


statement ok
CREATE FUNCTION f88374(i TEXT) RETURNS INT STRICT LANGUAGE SQL AS 'SELECT 2';

Note: I couldn't replicate the original example using INT2 and INT4 in the issue in 22.2 due to an ERROR: function "f88374" already exists with same argument types which is outside the scope of this PR. However, this patch fixes other types.

@rharding6373
Copy link
Collaborator Author

Gentle ping for a review on this backport!

@mgartner mgartner changed the title sql: fix ambigious udf overload with null arguments release-22.2: sql: fix ambigious udf overload with null arguments Aug 29, 2023
Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

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

Nice job tracking down the change that fixed this! :lgtm_strong:

For backports (even when they are non-standard like this), remember to prefix PR titles with release-XX.X: to denote that it's not being merged to the master branch. I added the prefix to this PR.

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


-- commits line 4 at r1:
nit: Can you link to the PR?


pkg/sql/logictest/testdata/logic_test/udf line 2849 at r1 (raw file):

Previously, rharding6373 (Rachael Harding) wrote…

Note: I couldn't replicate the original example using INT2 and INT4 in the issue in 22.2 due to an ERROR: function "f88374" already exists with same argument types which is outside the scope of this PR. However, this patch fixes other types.

That's fine. We never backported the fix (#96481) that allows multiple UDFs with non-identical types in the same family - which is why you're getting that error in 22.2.

This change backports a small change from a larger PR (cockroachdb#98162) that
prevents short-circuiting type checking for UDF function overloads. This
allows us to do more precise type checking even if inputs are NULL.

Epic: none
Fixes: cockroachdb#88374

Release note (bug fix): Fixes ambiguous calls to UDFs with NULL
arguments.
Copy link
Collaborator Author

@rharding6373 rharding6373 left a comment

Choose a reason for hiding this comment

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

Thanks for that.

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


-- commits line 4 at r1:

Previously, mgartner (Marcus Gartner) wrote…

nit: Can you link to the PR?

Done.

Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Add the "larger PR" number to the issue description too, if you'd like.

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

@rharding6373
Copy link
Collaborator Author

TFTR!

@rharding6373 rharding6373 merged commit 61588d3 into cockroachdb:release-22.2 Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants