-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: allow anonymous args and numeric arg references in UDFs #86005
Conversation
All commits except for the last are from #85786. I'll rebase this PR when that one is merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @mgartner, @michae2, and @msirek)
pkg/sql/opt/optbuilder/create_function.go
line 98 at r5 (raw file):
// named arguments to the scope so that references to them in the body can // be resolved. // TODO(mgartner): Support numeric argument references, like $1. We should
[nit] this comment is outdated
pkg/sql/opt/optbuilder/scalar.go
line 628 at r5 (raw file):
// can be resolved. // // TODO(mgartner): Support anonymous arguments and placeholder-like syntax
[nit] ditto
4a72155
to
b6b5485
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR!
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball, @michae2, and @msirek)
pkg/sql/opt/optbuilder/create_function.go
line 98 at r5 (raw file):
Previously, DrewKimball (Drew Kimball) wrote…
[nit] this comment is outdated
Good catch. Done.
pkg/sql/opt/optbuilder/scalar.go
line 628 at r5 (raw file):
Previously, DrewKimball (Drew Kimball) wrote…
[nit] ditto
Done.
b6b5485
to
059189f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 7 files at r5, 16 of 16 files at r6, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball and @michae2)
bd8e565
to
2cc5e79
Compare
This is going to be difficult to merge until we move the execution subtest section to the end of the udf test file: #86383. |
It is now possible to create UDFs with anonymous arguments that can be referenced like a placeholder in a prepared statement. For example: CREATE FUNCTION add(INT, INT) RETURNS INT LANGUAGE SQL AS $$ SELECT $1 + $2; $$ Named arguments can also be referenced by numeric placeholders. For example: CREATE FUNCTION add(x INT, y INT) RETURNS INT LANGUAGE SQL AS $$ SELECT x + $2; $$ Release note: None
2cc5e79
to
6e191d5
Compare
bors r+ |
Build succeeded: |
It is now possible to create UDFs with anonymous arguments that can be
referenced like a placeholder in a prepared statement. For example:
Named arguments can also be referenced by numeric placeholders. For
example:
Release note: None
Release justification: Adds critical functionality to a new feature.