From ac602b3c4f9581a5ef68681a416aa4ee3ff1eaaa Mon Sep 17 00:00:00 2001 From: healthy-pod Date: Fri, 21 Apr 2023 12:57:38 +0300 Subject: [PATCH] pkg/jobs: remove un-needed check for job_type column existence This code change makes the job creation code depend solely on the version gate to check if `V23_1AddTypeColumnToJobsTable` migration ran. `TestTelemetry/schema` was rewritten. Release note: None Epic: CRDB-21741 --- pkg/jobs/registry.go | 12 ------------ pkg/sql/testdata/telemetry/schema | 3 --- 2 files changed, 15 deletions(-) diff --git a/pkg/jobs/registry.go b/pkg/jobs/registry.go index e9d07902cc82..833ae134a16d 100644 --- a/pkg/jobs/registry.go +++ b/pkg/jobs/registry.go @@ -651,18 +651,6 @@ func (r *Registry) CreateJobWithTxn( override := sessiondata.RootUserSessionDataOverride override.Database = catconstants.SystemDatabaseName hasJobTypeColumn := r.settings.Version.IsActive(ctx, clusterversion.V23_1AddTypeColumnToJobsTable) - if hasJobTypeColumn { - // Relying on the version gate may not be sufficient. - const pgAttributeStmt = ` - SELECT * FROM system.pg_catalog.pg_attribute - WHERE attrelid = 'system.public.jobs'::REGCLASS - AND attname = 'job_type'` - row, err := txn.QueryRowEx(ctx, "job-columns-get", txn.KV(), override, pgAttributeStmt) - if err != nil { - return err - } - hasJobTypeColumn = row != nil - } if !hasJobTypeColumn { numCols -= 1 } diff --git a/pkg/sql/testdata/telemetry/schema b/pkg/sql/testdata/telemetry/schema index 3d2fffc1ba1f..bb9dadb97eb7 100644 --- a/pkg/sql/testdata/telemetry/schema +++ b/pkg/sql/testdata/telemetry/schema @@ -56,7 +56,6 @@ sql.schema.alter_table sql.schema.alter_table.add_column sql.schema.alter_table.add_column.references sql.schema.alter_table.add_constraint -sql.schema.get_virtual_table.pg_catalog.pg_attribute sql.schema.new_column_type.int8 sql.schema.schema_changer_mode.declarative @@ -108,7 +107,6 @@ ALTER TABLE on_update_t ADD COLUMN c INT DEFAULT 1 ON UPDATE 2; ---- sql.schema.alter_table sql.schema.alter_table.add_column -sql.schema.get_virtual_table.pg_catalog.pg_attribute sql.schema.new_column.qualification.default_expr sql.schema.new_column.qualification.on_update sql.schema.new_column_type.int8 @@ -160,7 +158,6 @@ feature-usage CREATE INDEX ON t(b) ---- sql.schema.create_index -sql.schema.get_virtual_table.pg_catalog.pg_attribute sql.schema.schema_changer_mode.declarative feature-usage