From c7c1ef5cd0e49df8f53e9f555a76e81334ad4144 Mon Sep 17 00:00:00 2001 From: rharding6373 Date: Fri, 7 Apr 2023 15:15:36 -0700 Subject: [PATCH] sql: add issue number for unimplemented udf default params 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 --- pkg/sql/create_function.go | 2 +- pkg/sql/logictest/testdata/logic_test/udf | 4 ++++ .../scbuild/internal/scbuildstmt/create_function.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/sql/create_function.go b/pkg/sql/create_function.go index 306df5aa8c2f..313ed04413c8 100644 --- a/pkg/sql/create_function.go +++ b/pkg/sql/create_function.go @@ -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 diff --git a/pkg/sql/logictest/testdata/logic_test/udf b/pkg/sql/logictest/testdata/logic_test/udf index 62c1b4732837..18b8121c9c2b 100644 --- a/pkg/sql/logictest/testdata/logic_test/udf +++ b/pkg/sql/logictest/testdata/logic_test/udf @@ -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 diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/create_function.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/create_function.go index 7cc86810edad..2891656dffce 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/create_function.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/create_function.go @@ -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 {