Skip to content

Commit

Permalink
Merge #100964
Browse files Browse the repository at this point in the history
100964: sql: add issue number for unimplemented udf default params r=chengxiong-ruan a=rharding6373

Adds a link to an issue number for UDF DEFAULT parameters, which are not currently supported.

Epic: None
Informs: #100962
Fixes: #99881

Release note: None

Co-authored-by: rharding6373 <[email protected]>
  • Loading branch information
craig[bot] and rharding6373 committed Apr 7, 2023
2 parents 6bf00e2 + c7c1ef5 commit 85e41ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/create_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ func makeFunctionParam(
}

if param.DefaultVal != nil {
return descpb.FunctionDescriptor_Parameter{}, unimplemented.New("CREATE FUNCTION argument", "default value")
return descpb.FunctionDescriptor_Parameter{}, unimplemented.NewWithIssue(100962, "default value")
}

return pbParam, nil
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/udf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ CREATE FUNCTION err(b BOOL) RETURNS INT LANGUAGE SQL AS 'SELECT b'
statement error return type mismatch in function declared to return bool\nDETAIL: Actual return type is int
CREATE FUNCTION err(i INT, j INT) RETURNS BOOL LANGUAGE SQL AS 'SELECT i - j'

# TODO(100962): Add support for default parameters.
statement error pgcode 0A000 unimplemented: default value
CREATE FUNCTION err(i INT, j INT DEFAULT 2) RETURNS INT LANGUAGE SQL AS 'SELECT i - j'

# Make sure using table name as tuple type name works properly.
# It should pass the return type validation and stored as a tuple type.
statement ok
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func CreateFunction(b BuildCtx, n *tree.CreateFunction) {
// TODO(chengxiong): create `FunctionParamDefaultExpression` element when
// default parameter default expression is enabled.
if param.DefaultVal != nil {
panic(unimplemented.New("CREATE FUNCTION argument", "default value"))
panic(unimplemented.NewWithIssue(100962, "default value"))
}
paramCls, err := funcinfo.ParamClassToProto(param.Class)
if err != nil {
Expand Down

0 comments on commit 85e41ca

Please sign in to comment.