Skip to content

Commit 7c3c4c8

Browse files
committed
workload/schemachange: allow dep error as potential error for ALTER PK
ALTER PRIMARY KEY has been observed to fail with the following error in the RSW: ``` ERROR: cannot drop column "rowid" because trigger "trigger_w0_190" on table "table_w1_104" depends on it (SQLSTATE 2BP01) ``` This change adds that dependency error to the set of potential errors for ALTER PRIMARY KEY operations. Informs #147514 Epic: none Release note: none
1 parent 3afeb1b commit 7c3c4c8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/workload/schemachange/operation_generator.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2870,6 +2870,9 @@ func (og *operationGenerator) alterTableAlterPrimaryKey(
28702870
// errors.
28712871
opStmt.potentialExecErrors.add(pgcode.InvalidColumnReference)
28722872
opStmt.potentialExecErrors.add(pgcode.DuplicateColumn)
2873+
// When altering a primary key, the implicit rowid column may be dropped,
2874+
// but triggers could reference it, causing a dependency violation.
2875+
opStmt.potentialExecErrors.add(pgcode.DependentObjectsStillExist)
28732876

28742877
return opStmt, nil
28752878
}

0 commit comments

Comments
 (0)