Skip to content

Commit 4689931

Browse files
author
James Cor
committed
string concat instead of sprintf
1 parent 87470a0 commit 4689931

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

sql/analyzer/costed_index_scan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ type iScanLeaf struct {
10861086

10871087
func (l *iScanLeaf) normString() string {
10881088
if l.underlying != "" {
1089-
return fmt.Sprintf("%s.%s", strings.ToLower(l.underlying), strings.ToLower(l.gf.Name()))
1089+
return strings.ToLower(l.underlying) + "." + strings.ToLower(l.gf.Name())
10901090
}
10911091
return strings.ToLower(l.gf.String())
10921092
}

sql/planbuilder/ddl.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,11 +1726,12 @@ func (b *Builder) resolveColumnDefaultExpression(inScope *scope, columnDef *sql.
17261726

17271727
// Empty string is a special case, it means the default value is the empty string
17281728
// TODO: why isn't this serialized as ''
1729-
if def.String() == "" {
1729+
defStr := def.String()
1730+
if defStr == "" {
17301731
return b.convertDefaultExpression(inScope, &ast.SQLVal{Val: []byte{}, Type: ast.StrVal}, columnDef.Type, columnDef.Nullable)
17311732
}
17321733

1733-
parsed, err := b.parser.ParseSimple(fmt.Sprintf("SELECT %s", def))
1734+
parsed, err := b.parser.ParseSimple("SELECT " + defStr)
17341735
if err != nil {
17351736
err := sql.ErrInvalidColumnDefaultValue.Wrap(err, def)
17361737
b.handleErr(err)

0 commit comments

Comments
 (0)