diff --git a/pkg/ccl/logictestccl/tests/3node-tenant/generated_test.go b/pkg/ccl/logictestccl/tests/3node-tenant/generated_test.go index a3cc7825b798..8a4beb7c39e8 100644 --- a/pkg/ccl/logictestccl/tests/3node-tenant/generated_test.go +++ b/pkg/ccl/logictestccl/tests/3node-tenant/generated_test.go @@ -463,13 +463,6 @@ func TestTenantLogic_create_as( runLogicTest(t, "create_as") } -func TestTenantLogic_create_as_non_metamorphic( - t *testing.T, -) { - defer leaktest.AfterTest(t)() - runLogicTest(t, "create_as_non_metamorphic") -} - func TestTenantLogic_create_index( t *testing.T, ) { diff --git a/pkg/sql/colexec/columnarizer.go b/pkg/sql/colexec/columnarizer.go index d74a5d7d9a5f..09c18bf4ca8f 100644 --- a/pkg/sql/colexec/columnarizer.go +++ b/pkg/sql/colexec/columnarizer.go @@ -300,6 +300,13 @@ func (c *Columnarizer) Close(context.Context) error { return nil } c.helper.Release() + if c.Ctx == nil { + // The columnarizer wasn't initialized, so the wrapped processors might + // not have been started leaving them in a state unsafe for the + // InternalClose, so we skip that. Mostly likely this happened because a + // panic was encountered in Init. + return nil + } c.InternalClose() return nil } diff --git a/pkg/sql/colexecop/operator.go b/pkg/sql/colexecop/operator.go index 868ffb37e2e9..14333fcde815 100644 --- a/pkg/sql/colexecop/operator.go +++ b/pkg/sql/colexecop/operator.go @@ -157,11 +157,6 @@ type Closer interface { // (wherever necessary) by the implementation. This is so since the span in // the context from Init() might be already finished when Close() is called // whereas the argument context will contain an unfinished span. - // - // If this Closer is an execinfra.Releasable, the implementation must be - // safe to execute even after Release() was called. - // TODO(yuzefovich): refactor this because the Release()'d objects should - // not be used anymore. Close(context.Context) error } diff --git a/pkg/sql/colfetcher/index_join.go b/pkg/sql/colfetcher/index_join.go index 285ffde79b8c..7a40a153b1b9 100644 --- a/pkg/sql/colfetcher/index_join.go +++ b/pkg/sql/colfetcher/index_join.go @@ -682,9 +682,6 @@ func (s *ColIndexJoin) closeInternal() { // span. ctx := s.EnsureCtx() s.cf.Close(ctx) - if s.spanAssembler != nil { - // spanAssembler can be nil if Release() has already been called. - s.spanAssembler.Close() - } + s.spanAssembler.Close() s.batch = nil } diff --git a/pkg/sql/logictest/testdata/logic_test/alter_primary_key b/pkg/sql/logictest/testdata/logic_test/alter_primary_key index 06512541bcaf..2d96b9c2ffd9 100644 --- a/pkg/sql/logictest/testdata/logic_test/alter_primary_key +++ b/pkg/sql/logictest/testdata/logic_test/alter_primary_key @@ -4,6 +4,9 @@ CREATE TABLE t (x INT PRIMARY KEY, y INT NOT NULL, z INT NOT NULL, w INT, INDEX statement ok INSERT INTO t VALUES (1, 2, 3, 4), (5, 6, 7, 8) +statement error pgcode 0A000 .* contains duplicate column \"y\" +ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (y, y) + statement ok ALTER TABLE t ALTER PRIMARY KEY USING COLUMNS (y, z) diff --git a/pkg/sql/logictest/testdata/logic_test/create_as_non_metamorphic b/pkg/sql/logictest/testdata/logic_test/create_as_non_metamorphic index a2d1a06ef397..98f706a1e8ee 100644 --- a/pkg/sql/logictest/testdata/logic_test/create_as_non_metamorphic +++ b/pkg/sql/logictest/testdata/logic_test/create_as_non_metamorphic @@ -1,15 +1,15 @@ -# LogicTest: !metamorphic-batch-sizes +# LogicTest: !metamorphic-batch-sizes local # Disabled to allow us to validate create as with large batch sizes. # Regression test for #81554, where tried to do gigantic batches for CTAS in # explicit transactions. Use a fixed command size, so that an error is decoupled # fom the default size. statement ok -SET CLUSTER SETTING kv.raft.command.max_size='5m' +SET CLUSTER SETTING kv.raft.command.max_size='4.01MiB' statement ok BEGIN; -CREATE TABLE source_tbl_huge AS SELECT 1::CHAR(256) FROM generate_series(1, 500000); +CREATE TABLE source_tbl_huge AS SELECT 1::CHAR(256) FROM generate_series(1, 50000); COMMIT; statement ok diff --git a/pkg/sql/logictest/tests/fakedist-disk/generated_test.go b/pkg/sql/logictest/tests/fakedist-disk/generated_test.go index 7d189f363980..f54590b16c63 100644 --- a/pkg/sql/logictest/tests/fakedist-disk/generated_test.go +++ b/pkg/sql/logictest/tests/fakedist-disk/generated_test.go @@ -436,13 +436,6 @@ func TestLogic_create_as( runLogicTest(t, "create_as") } -func TestLogic_create_as_non_metamorphic( - t *testing.T, -) { - defer leaktest.AfterTest(t)() - runLogicTest(t, "create_as_non_metamorphic") -} - func TestLogic_create_index( t *testing.T, ) { diff --git a/pkg/sql/logictest/tests/fakedist-vec-off/generated_test.go b/pkg/sql/logictest/tests/fakedist-vec-off/generated_test.go index 48afc0084fd8..4e41d13f6a09 100644 --- a/pkg/sql/logictest/tests/fakedist-vec-off/generated_test.go +++ b/pkg/sql/logictest/tests/fakedist-vec-off/generated_test.go @@ -436,13 +436,6 @@ func TestLogic_create_as( runLogicTest(t, "create_as") } -func TestLogic_create_as_non_metamorphic( - t *testing.T, -) { - defer leaktest.AfterTest(t)() - runLogicTest(t, "create_as_non_metamorphic") -} - func TestLogic_create_index( t *testing.T, ) { diff --git a/pkg/sql/logictest/tests/fakedist/generated_test.go b/pkg/sql/logictest/tests/fakedist/generated_test.go index 945b1a05a5d4..d3d21669f940 100644 --- a/pkg/sql/logictest/tests/fakedist/generated_test.go +++ b/pkg/sql/logictest/tests/fakedist/generated_test.go @@ -436,13 +436,6 @@ func TestLogic_create_as( runLogicTest(t, "create_as") } -func TestLogic_create_as_non_metamorphic( - t *testing.T, -) { - defer leaktest.AfterTest(t)() - runLogicTest(t, "create_as_non_metamorphic") -} - func TestLogic_create_index( t *testing.T, ) { diff --git a/pkg/sql/logictest/tests/local-legacy-schema-changer/generated_test.go b/pkg/sql/logictest/tests/local-legacy-schema-changer/generated_test.go index 69ca0b7d1d79..41227eca724f 100644 --- a/pkg/sql/logictest/tests/local-legacy-schema-changer/generated_test.go +++ b/pkg/sql/logictest/tests/local-legacy-schema-changer/generated_test.go @@ -436,13 +436,6 @@ func TestLogic_create_as( runLogicTest(t, "create_as") } -func TestLogic_create_as_non_metamorphic( - t *testing.T, -) { - defer leaktest.AfterTest(t)() - runLogicTest(t, "create_as_non_metamorphic") -} - func TestLogic_create_index( t *testing.T, ) { diff --git a/pkg/sql/logictest/tests/local-vec-off/generated_test.go b/pkg/sql/logictest/tests/local-vec-off/generated_test.go index c593154895c1..ba4c9b7505a7 100644 --- a/pkg/sql/logictest/tests/local-vec-off/generated_test.go +++ b/pkg/sql/logictest/tests/local-vec-off/generated_test.go @@ -436,13 +436,6 @@ func TestLogic_create_as( runLogicTest(t, "create_as") } -func TestLogic_create_as_non_metamorphic( - t *testing.T, -) { - defer leaktest.AfterTest(t)() - runLogicTest(t, "create_as_non_metamorphic") -} - func TestLogic_create_index( t *testing.T, ) { diff --git a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_primary_key.go b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_primary_key.go index 113e42338fdd..96b6575809fd 100644 --- a/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_primary_key.go +++ b/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_primary_key.go @@ -208,6 +208,7 @@ func checkForEarlyExit(b BuildCtx, tbl *scpb.Table, t alterPrimaryKeySpec) { panic(err) } + usedColumns := make(map[tree.Name]bool, len(t.Columns)) for _, col := range t.Columns { if col.Column == "" && col.Expr != nil { panic(errors.WithHint( @@ -219,6 +220,11 @@ func checkForEarlyExit(b BuildCtx, tbl *scpb.Table, t alterPrimaryKeySpec) { "use columns instead", )) } + if usedColumns[col.Column] { + panic(pgerror.Newf(pgcode.FeatureNotSupported, + "new primary key contains duplicate column %q", col.Column)) + } + usedColumns[col.Column] = true colElems := b.ResolveColumn(tbl.TableID, col.Column, ResolveParams{ IsExistenceOptional: false, diff --git a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetails.tsx b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetails.tsx index e3a5f3ed6218..2fd79fe235ab 100644 --- a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetails.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetails.tsx @@ -177,7 +177,7 @@ export class TransactionInsightDetails extends React.Component -
+