aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/vm/sqlvm/parser/parser.go3
-rw-r--r--core/vm/sqlvm/parser/parser_test.go1
2 files changed, 4 insertions, 0 deletions
diff --git a/core/vm/sqlvm/parser/parser.go b/core/vm/sqlvm/parser/parser.go
index 76fa15cdc..2e882ea3c 100644
--- a/core/vm/sqlvm/parser/parser.go
+++ b/core/vm/sqlvm/parser/parser.go
@@ -95,6 +95,9 @@ func toUint(b []byte) (uint32, errors.ErrorCode) {
}
func toDecimal(b []byte) (decimal.Decimal, errors.ErrorCode) {
+ if len(b) > 0 && b[0] == byte('.') {
+ b = append([]byte{'0'}, b...)
+ }
d, err := decimal.NewFromString(string(b))
return d, convertDecimalError(err)
}
diff --git a/core/vm/sqlvm/parser/parser_test.go b/core/vm/sqlvm/parser/parser_test.go
index 77c3c16ff..bed734c60 100644
--- a/core/vm/sqlvm/parser/parser_test.go
+++ b/core/vm/sqlvm/parser/parser_test.go
@@ -22,6 +22,7 @@ func (s *ParserTestSuite) TestParse() {
// Test expr.
s.requireParseNoError(`select 1 + 2 * 3`)
+ s.requireParseNoError(`select .0`)
s.requireParseNoError(`select a(1 + 1)`)
s.requireParseNoError(`select hEx'12'`)
s.requireParseNoError(`select x'12'`)