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: fix recently introduced nil pointer in error case #121222

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

yuzefovich
Copy link
Member

This commit fixes a recently introduced nil pointer internal error when attempting to CALL not a procedure that is specified not by its name. ResolvableFunctionReference might not have ReferenceByName, so this commit switches to using FunctionReference that is always set.

Fixes: #121095.

Release note: None

This commit fixes a recently introduced nil pointer internal error when
attempting to CALL not a procedure that is specified not by its name.
`ResolvableFunctionReference` might not have `ReferenceByName`, so this
commit switches to using `FunctionReference` that is always set.

Release note: None
@yuzefovich yuzefovich requested a review from a team as a code owner March 27, 2024 16:39
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@michae2 michae2 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 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball, @mgartner, and @yuzefovich)


pkg/sql/opt/optbuilder/routine.go line 129 at r1 (raw file):

	if !ok {
		panic(pgerror.Newf(pgcode.WrongObjectType,
			"%s is not a procedure", c.Proc.Func.String(),

micro-nit: I think if you use %v on c.Proc.Func, then String() will be called automatically. But this is fine, too, of course.

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! 1 of 0 LGTMs obtained (waiting on @DrewKimball, @mgartner, and @michae2)


pkg/sql/opt/optbuilder/routine.go line 129 at r1 (raw file):

Previously, michae2 (Michael Erickson) wrote…

micro-nit: I think if you use %v on c.Proc.Func, then String() will be called automatically. But this is fine, too, of course.

Yeah, I think you're right, but I prefer being explicit, so I'll keep this as is.

@craig craig bot merged commit 3e488c5 into cockroachdb:master Mar 27, 2024
22 checks passed
@yuzefovich yuzefovich deleted the fix-call-error branch March 27, 2024 19:14
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.

sql/tests: TestRandomSyntaxGeneration failed [CALL causes nil pointer access]
3 participants