Skip to content

Commit 5fcadbd

Browse files
craig[bot]spilchen
andcommitted
Merge #153039
153039: workload/schemachange: expect DatatypeMismatch errors for NULL defaults r=spilchen a=spilchen Previously, the workload only expected DatatypeMismatch errors when setting default values that were non-NULL. However, after fixing the type casting syntax in SET DEFAULT operations, NULL values with explicit type casts (e.g., NULL::enum_type) now properly reach the type checker and correctly produce DatatypeMismatch errors when the cast type doesn't match the column type. Fixes #152957 Release note: none Epic: None Co-authored-by: Matt Spilchen <[email protected]>
2 parents 1d87ee7 + 9609a29 commit 5fcadbd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/workload/schemachange/operation_generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2520,7 +2520,7 @@ func (og *operationGenerator) setColumnDefault(ctx context.Context, tx pgx.Tx) (
25202520

25212521
defaultDatum := randgen.RandDatum(og.params.rng, datumTyp, columnForDefault.nullable)
25222522
stmt := makeOpStmt(OpStmtDDL)
2523-
if (!datumTyp.Equivalent(columnForDefault.typ)) && defaultDatum != tree.DNull {
2523+
if !datumTyp.Equivalent(columnForDefault.typ) {
25242524
stmt.expectedExecErrors.add(pgcode.DatatypeMismatch)
25252525
}
25262526
// Generated columns cannot have default values.

0 commit comments

Comments
 (0)