Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/sqlcmd/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func ValidIdentifier(name string) error {

first := true
for _, c := range name {
if !unicode.IsLetter(c) && (first || (!unicode.IsDigit(c) && !strings.ContainsRune(validVariableRunes, c))) {
if !unicode.IsLetter(c) && c != '_' && (first || (!unicode.IsDigit(c) && !strings.ContainsRune(validVariableRunes, c))) {
return fmt.Errorf("Invalid variable identifier %s", name)
}
first = false
Expand Down
1 change: 1 addition & 0 deletions pkg/sqlcmd/variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func TestValidIdentifier(t *testing.T) {
{"A1", true},
{"A+", false},
{"A-_b", true},
{"__X", true},
}
for _, tst := range tests {
err := ValidIdentifier(tst.raw)
Expand Down