Skip to content

Commit

Permalink
sql: hide enable_drop_enum_value session/cluster setting
Browse files Browse the repository at this point in the history
Release note (sql change): The enable_drop_enum_value session variable
has been removed, along with the corresponding cluter setting. The
functionality of being able to drop enum values is now enabled
automatically. Queries that refer to the session/cluster setting will
still work but will have no effect.
  • Loading branch information
rafiss committed Sep 20, 2021
1 parent 43f0d27 commit 2ecbdf2
Show file tree
Hide file tree
Showing 22 changed files with 129 additions and 237 deletions.
1 change: 0 additions & 1 deletion docs/generated/settings/settings-for-tenants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ sql.defaults.datestyle.enabled boolean false default value for datestyle_enabled
sql.defaults.default_int_size integer 8 the size, in bytes, of an INT type
sql.defaults.disallow_full_table_scans.enabled boolean false setting to true rejects queries that have planned a full table scan
sql.defaults.distsql enumeration auto default distributed SQL execution mode [off = 0, auto = 1, on = 2]
sql.defaults.drop_enum_value.enabled boolean false default value for enable_drop_enum_value; allows for dropping enum values
sql.defaults.experimental_alter_column_type.enabled boolean false default value for experimental_alter_column_type session setting; enables the use of ALTER COLUMN TYPE for general conversions
sql.defaults.experimental_auto_rehoming.enabled boolean false default value for experimental_enable_auto_rehoming; allows for rows in REGIONAL BY ROW tables to be auto-rehomed on UPDATE
sql.defaults.experimental_distsql_planning enumeration off default experimental_distsql_planning mode; enables experimental opt-driven DistSQL planning [off = 0, on = 1]
Expand Down
1 change: 0 additions & 1 deletion docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
<tr><td><code>sql.defaults.default_int_size</code></td><td>integer</td><td><code>8</code></td><td>the size, in bytes, of an INT type</td></tr>
<tr><td><code>sql.defaults.disallow_full_table_scans.enabled</code></td><td>boolean</td><td><code>false</code></td><td>setting to true rejects queries that have planned a full table scan</td></tr>
<tr><td><code>sql.defaults.distsql</code></td><td>enumeration</td><td><code>auto</code></td><td>default distributed SQL execution mode [off = 0, auto = 1, on = 2]</td></tr>
<tr><td><code>sql.defaults.drop_enum_value.enabled</code></td><td>boolean</td><td><code>false</code></td><td>default value for enable_drop_enum_value; allows for dropping enum values</td></tr>
<tr><td><code>sql.defaults.experimental_alter_column_type.enabled</code></td><td>boolean</td><td><code>false</code></td><td>default value for experimental_alter_column_type session setting; enables the use of ALTER COLUMN TYPE for general conversions</td></tr>
<tr><td><code>sql.defaults.experimental_auto_rehoming.enabled</code></td><td>boolean</td><td><code>false</code></td><td>default value for experimental_enable_auto_rehoming; allows for rows in REGIONAL BY ROW tables to be auto-rehomed on UPDATE</td></tr>
<tr><td><code>sql.defaults.experimental_distsql_planning</code></td><td>enumeration</td><td><code>off</code></td><td>default experimental_distsql_planning mode; enables experimental opt-driven DistSQL planning [off = 0, on = 1]</td></tr>
Expand Down
2 changes: 0 additions & 2 deletions pkg/ccl/backupccl/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3007,8 +3007,6 @@ func TestBackupRestoreDuringUserDefinedTypeChange(t *testing.T) {

// Create a database with a type.
sqlDB.Exec(t, `
SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
SET enable_drop_enum_value = true;
CREATE DATABASE d;
CREATE TYPE d.greeting AS ENUM ('hello', 'howdy', 'hi');
`)
Expand Down
2 changes: 0 additions & 2 deletions pkg/ccl/importccl/import_stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7318,8 +7318,6 @@ func TestUDTChangeDuringImport(t *testing.T) {

// Create a database with a type.
sqlDB.Exec(t, `
SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
SET enable_drop_enum_value = true;
CREATE DATABASE d;
USE d;
CREATE TYPE d.greeting AS ENUM ('hello', 'howdy', 'hi');
Expand Down
3 changes: 0 additions & 3 deletions pkg/ccl/logictestccl/testdata/logic_test/partitioning_enum
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ subtest drop_enum_partitioning_value
statement ok
drop table if exists tbl;
drop type if exists t;
set enable_drop_enum_value = true;
create type t as enum('a', 'b', 'c');
create table tbl (pk t PRIMARY KEY) PARTITION BY LIST (pk) (PARTITION "a" VALUES IN ('a'))

Expand All @@ -72,7 +71,6 @@ alter type t drop value 'a'
statement ok
drop table if exists tbl;
drop type if exists t;
set enable_drop_enum_value = true;
create type t as enum('a', 'b', 'c');
create table tbl (i INT, k t, PRIMARY KEY (i, k)) PARTITION BY LIST (i) (PARTITION "one" VALUES IN (1) PARTITION BY RANGE (k) (PARTITION "a" VALUES FROM ('a') TO ('b')))

Expand All @@ -82,7 +80,6 @@ alter type t drop value 'a'
statement ok
drop table if exists tbl;
drop type if exists t;
set enable_drop_enum_value = true;
create type t as enum('a', 'b', 'c');
create table tbl (i INT, k t, PRIMARY KEY (i, k), INDEX idx (k) PARTITION BY RANGE (k) (PARTITION "a" VALUES FROM ('a') TO ('b')))

Expand Down
4 changes: 0 additions & 4 deletions pkg/internal/sqlsmith/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ func wrapCommonSetup(setupFn Setup) Setup {
return func(r *rand.Rand) string {
s := setupFn(r)
var sb strings.Builder
sb.WriteString(`
SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
SET enable_drop_enum_value = true;
`)
sb.WriteString(s)
return sb.String()
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/settings/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ var retiredSettings = map[string]struct{}{
"sql.distsql.prefer_local_execution.enabled": {},
"kv.follower_read.target_multiple": {},
"kv.closed_timestamp.close_fraction": {},

// removed as of 22.1.
"sql.defaults.drop_enum_value.enabled": {},
}

// register adds a setting to the registry.
Expand Down
13 changes: 0 additions & 13 deletions pkg/sql/alter_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package sql
import (
"context"

"github.com/cockroachdb/cockroach/pkg/build"
"github.com/cockroachdb/cockroach/pkg/security"
"github.com/cockroachdb/cockroach/pkg/server/telemetry"
"github.com/cockroachdb/cockroach/pkg/sql/catalog"
Expand Down Expand Up @@ -117,18 +116,6 @@ func (n *alterTypeNode) startExec(params runParams) error {
}
eventLogDone = true // done inside alterTypeOwner().
case *tree.AlterTypeDropValue:
if !params.p.SessionData().DropEnumValueEnabled {
return pgerror.WithCandidateCode(
errors.WithHint(
errors.WithIssueLink(
errors.New("ALTER TYPE ... DROP VALUE ... is only supported as an alpha feature "+
"since view, default, or computed expressions will stop working if they reference the "+
"ENUM value"),
errors.IssueLink{IssueURL: build.MakeIssueURL(61594)}),
"you can enable alter type drop value by running "+
"`SET enable_drop_enum_value = true`"),
pgcode.FeatureNotSupported)
}
err = params.p.dropEnumValue(params.ctx, n.desc, t.Val)
default:
err = errors.AssertionFailedf("unknown alter type cmd %s", t)
Expand Down
10 changes: 0 additions & 10 deletions pkg/sql/exec_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,6 @@ var implicitColumnPartitioningEnabledClusterMode = settings.RegisterBoolSetting(
false,
).WithPublic()

var dropEnumValueEnabledClusterMode = settings.RegisterBoolSetting(
"sql.defaults.drop_enum_value.enabled",
"default value for enable_drop_enum_value; allows for dropping enum values",
false,
).WithPublic()

var overrideMultiRegionZoneConfigClusterMode = settings.RegisterBoolSetting(
"sql.defaults.override_multi_region_zone_config.enabled",
"default value for override_multi_region_zone_config; "+
Expand Down Expand Up @@ -2844,10 +2838,6 @@ func (m *sessionDataMutator) SetImplicitColumnPartitioningEnabled(val bool) {
m.data.ImplicitColumnPartitioningEnabled = val
}

func (m *sessionDataMutator) SetDropEnumValueEnabled(val bool) {
m.data.DropEnumValueEnabled = val
}

func (m *sessionDataMutator) SetOverrideMultiRegionZoneConfigEnabled(val bool) {
m.data.OverrideMultiRegionZoneConfigEnabled = val
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/sql/logictest/testdata/logic_test/alter_type
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,6 @@ SELECT 'lru'::store
statement ok
CREATE TYPE greetings AS ENUM('hi', 'hello', 'howdy', 'yo')

statement error pq: ALTER TYPE ... DROP VALUE ... is only supported as an alpha feature
ALTER TYPE greetings DROP VALUE 'hi'

statement ok
SET enable_drop_enum_value = true;

statement ok
ALTER TYPE greetings DROP VALUE 'hi'

Expand Down
6 changes: 0 additions & 6 deletions pkg/sql/logictest/testdata/logic_test/enums
Original file line number Diff line number Diff line change
Expand Up @@ -1369,9 +1369,6 @@ SELECT * from arr_t5
# or computed column, we disallow dropping it.
subtest drop_used_enum_values

statement ok
SET enable_drop_enum_value = true

statement ok
CREATE TYPE default_abc AS ENUM ('a', 'b', 'c')

Expand Down Expand Up @@ -1511,9 +1508,6 @@ typ2

subtest drop_enum_value_index_predicate

statement ok
SET enable_drop_enum_value = true;

statement ok
DROP TYPE IF EXISTS enum_for_predicate;
CREATE TYPE enum_for_predicate AS ENUM ('a', 'b');
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/information_schema
Original file line number Diff line number Diff line change
Expand Up @@ -4602,7 +4602,7 @@ disable_partially_distributed_plans off
disallow_full_table_scans off
distsql_workmem 64 MiB
enable_copying_partitioning_when_deinterleaving_table off
enable_drop_enum_value off
enable_drop_enum_value on
enable_experimental_alter_column_type_general off
enable_experimental_stream_replication off
enable_implicit_select_for_update on
Expand Down
3 changes: 0 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/on_update
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,6 @@ SELECT p, k FROM test_table_enum
----
pk1 y

statement ok
SET enable_drop_enum_value = true

statement ok
ALTER TYPE test_enum DROP VALUE 'z'

Expand Down
3 changes: 0 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/pg_catalog
Original file line number Diff line number Diff line change
Expand Up @@ -3926,7 +3926,6 @@ disallow_full_table_scans off NULL
distsql off NULL NULL NULL string
distsql_workmem 64 MiB NULL NULL NULL string
enable_copying_partitioning_when_deinterleaving_table off NULL NULL NULL string
enable_drop_enum_value off NULL NULL NULL string
enable_experimental_alter_column_type_general off NULL NULL NULL string
enable_experimental_stream_replication off NULL NULL NULL string
enable_implicit_select_for_update on NULL NULL NULL string
Expand Down Expand Up @@ -4022,7 +4021,6 @@ disallow_full_table_scans off NULL
distsql off NULL user NULL off off
distsql_workmem 64 MiB NULL user NULL 64 MiB 64 MiB
enable_copying_partitioning_when_deinterleaving_table off NULL user NULL off off
enable_drop_enum_value off NULL user NULL off off
enable_experimental_alter_column_type_general off NULL user NULL off off
enable_experimental_stream_replication off NULL user NULL off off
enable_implicit_select_for_update on NULL user NULL on on
Expand Down Expand Up @@ -4114,7 +4112,6 @@ disallow_full_table_scans NULL NULL NULL
distsql NULL NULL NULL NULL NULL
distsql_workmem NULL NULL NULL NULL NULL
enable_copying_partitioning_when_deinterleaving_table NULL NULL NULL NULL NULL
enable_drop_enum_value NULL NULL NULL NULL NULL
enable_experimental_alter_column_type_general NULL NULL NULL NULL NULL
enable_experimental_stream_replication NULL NULL NULL NULL NULL
enable_implicit_select_for_update NULL NULL NULL NULL NULL
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/logictest/testdata/logic_test/show_source
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ disallow_full_table_scans off
distsql off
distsql_workmem 64 MiB
enable_copying_partitioning_when_deinterleaving_table off
enable_drop_enum_value off
enable_experimental_alter_column_type_general off
enable_experimental_stream_replication off
enable_implicit_select_for_update on
Expand Down
Loading

0 comments on commit 2ecbdf2

Please sign in to comment.