Skip to content

Commit 2c3db2f

Browse files
committed
fix logic to extract allowCommitTimestamp
1 parent 9bed983 commit 2c3db2f

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

loaders/parser.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,21 @@ func (s *SpannerLoaderFromDDL) ColumnList(name string) ([]*models.Column, error)
132132
if _, ok := c.DefaultSemantics.(*ast.GeneratedColumnExpr); ok {
133133
isGenerated = true
134134
}
135+
135136
allowCommitTimestamp := false
136137
if c.Options != nil {
137-
allowCommitTimestamp = c.Options.AllowCommitTimestamp
138+
for _, r := range c.Options.Records {
139+
if r.Name.Name == "allow_commit_timestamp" {
140+
boolLiteral, ok := r.Value.(*ast.BoolLiteral)
141+
if !ok {
142+
return nil, fmt.Errorf("the type of 'allow_commit_timestamp' should be 'bool', but got '%T'", r.Value)
143+
}
144+
allowCommitTimestamp = boolLiteral.Value
145+
break
146+
}
147+
}
138148
}
149+
139150
cols = append(cols, &models.Column{
140151
FieldOrdinal: i + 1,
141152
ColumnName: c.Name.Name,

0 commit comments

Comments
 (0)