From 0d6452ee686be5cfdd189011f25b91a60bd7c66e Mon Sep 17 00:00:00 2001 From: Chengxiong Ruan Date: Mon, 27 Feb 2023 16:42:17 -0500 Subject: [PATCH] sql: remove CREATE FUNCTION 22.2 version gate Informs: #96763, #96751 Release note: None. --- pkg/sql/create_function.go | 12 ----------- pkg/sql/create_function_test.go | 38 --------------------------------- 2 files changed, 50 deletions(-) diff --git a/pkg/sql/create_function.go b/pkg/sql/create_function.go index b5ed58cabe1e..ecbcb68369cb 100644 --- a/pkg/sql/create_function.go +++ b/pkg/sql/create_function.go @@ -14,7 +14,6 @@ import ( "context" "fmt" - "github.com/cockroachdb/cockroach/pkg/clusterversion" "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/sql/catalog" "github.com/cockroachdb/cockroach/pkg/sql/catalog/catpb" @@ -44,17 +43,6 @@ type createFunctionNode struct { func (n *createFunctionNode) ReadingOwnWrites() {} func (n *createFunctionNode) startExec(params runParams) error { - if !params.EvalContext().Settings.Version.IsActive( - params.ctx, - clusterversion.TODODelete_V22_2SchemaChangeSupportsCreateFunction, - ) { - // TODO(chengxiong): remove this version gate in 23.1. - return pgerror.Newf( - pgcode.FeatureNotSupported, - "cannot run CREATE FUNCTION before system is fully upgraded to v22.2", - ) - } - if n.cf.RoutineBody != nil { return unimplemented.NewWithIssue(85144, "CREATE FUNCTION...sql_body unimplemented") } diff --git a/pkg/sql/create_function_test.go b/pkg/sql/create_function_test.go index cc0741cf64f4..9b729d0213b1 100644 --- a/pkg/sql/create_function_test.go +++ b/pkg/sql/create_function_test.go @@ -28,7 +28,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/tests" "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" - "github.com/cockroachdb/cockroach/pkg/testutils/skip" "github.com/cockroachdb/cockroach/pkg/testutils/sqlutils" "github.com/cockroachdb/cockroach/pkg/util/leaktest" "github.com/cockroachdb/cockroach/pkg/util/log" @@ -153,43 +152,6 @@ SELECT nextval(105:::REGCLASS);`, require.NoError(t, err) } -func TestGatingCreateFunction(t *testing.T) { - defer leaktest.AfterTest(t)() - - skip.WithIssue(t, 95530, "bump minBinary to 22.2. Skip 22.2 mixed-version tests for future cleanup") - - t.Run("new_schema_changer_version_enabled", func(t *testing.T) { - params, _ := tests.CreateTestServerParams() - // Override binary version to be older. - params.Knobs.Server = &server.TestingKnobs{ - DisableAutomaticVersionUpgrade: make(chan struct{}), - BinaryVersionOverride: clusterversion.ByKey(clusterversion.TODODelete_V22_2SchemaChangeSupportsCreateFunction), - } - - s, sqlDB, _ := serverutils.StartServer(t, params) - defer s.Stopper().Stop(context.Background()) - - _, err := sqlDB.Exec(`CREATE FUNCTION f() RETURNS INT LANGUAGE SQL AS $$ SELECT 1 $$`) - require.NoError(t, err) - }) - - t.Run("new_schema_changer_version_disabled", func(t *testing.T) { - params, _ := tests.CreateTestServerParams() - // Override binary version to be older. - params.Knobs.Server = &server.TestingKnobs{ - DisableAutomaticVersionUpgrade: make(chan struct{}), - BinaryVersionOverride: clusterversion.ByKey(clusterversion.TODODelete_V22_2SchemaChangeSupportsCreateFunction - 1), - } - - s, sqlDB, _ := serverutils.StartServer(t, params) - defer s.Stopper().Stop(context.Background()) - - _, err := sqlDB.Exec(`CREATE FUNCTION f() RETURNS INT LANGUAGE SQL AS $$ SELECT 1 $$`) - require.Error(t, err) - require.Equal(t, "pq: cannot run CREATE FUNCTION before system is fully upgraded to v22.2", err.Error()) - }) -} - func TestVersionGatingUDFInCheckConstraints(t *testing.T) { defer leaktest.AfterTest(t)()