Skip to content

Commit

Permalink
tabledesc: add missing test for computed column validation
Browse files Browse the repository at this point in the history
This commit adds a missing test in our validation test suite to cover
the forbidden case of a computed column which also has an ON UPDATE
expression set.

Release note: None
  • Loading branch information
Marius Posta committed Nov 24, 2021
1 parent 5b4ce82 commit d49bdc1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/sql/catalog/tabledesc/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,22 @@ func TestValidateTableDesc(t *testing.T) {
},
NextColumnID: 2,
}},
{`computed column "bar" cannot also have an ON UPDATE expression`,
descpb.TableDescriptor{
ID: 2,
ParentID: 1,
Name: "foo",
FormatVersion: descpb.InterleavedFormatVersion,
Columns: []descpb.ColumnDescriptor{
{
ID: 1,
Name: "bar",
ComputeExpr: &computedExpr,
OnUpdateExpr: &computedExpr,
},
},
NextColumnID: 2,
}},
}
for i, d := range testData {
t.Run(d.err, func(t *testing.T) {
Expand Down

0 comments on commit d49bdc1

Please sign in to comment.