Skip to content

Commit 456c1ee

Browse files
committed
Fix division using slash as an operator. Require a space between operands for it to be usable.
1 parent c18b20c commit 456c1ee

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

parser/sqlparser/token.go

+3
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,9 @@ func (tkn *Tokenizer) scanIdentifier(firstBytes []byte, isDbSystemVariable bool)
735735
if loweredStr == "dual" {
736736
return ID, lowered
737737
}
738+
if buffer.String() == "/" {
739+
return int('/'), nil
740+
}
738741
return ID, buffer.Bytes()
739742
}
740743

tests/scenarios/functions/arithmetic.in

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ octosql "SELECT 1 + 2,
1717
7 * INTERVAL 3 SECOND,
1818
'test1' * 3,
1919
3 * 'test1',
20-
/(7, 3),
21-
/(7.0, 3.0),
22-
/(INTERVAL 7 SECOND, 3),
23-
/(INTERVAL 7 SECOND, INTERVAL 3 SECOND)"
20+
7 / 3,
21+
7.0 / 3.0,
22+
INTERVAL 7 SECOND / 3,
23+
INTERVAL 7 SECOND / INTERVAL 3 SECOND"
2424

0 commit comments

Comments
 (0)