Index: src/util.c ================================================================== --- src/util.c +++ src/util.c @@ -558,11 +558,11 @@ *pResult = result; /* return true if number and no extra non-whitespace chracters after */ if( z==zEnd && nDigit>0 && eValid && eType>0 ){ return eType; - }else if( eType>=2 && (eType==3 || eValid) ){ + }else if( eType>=2 && (eType==3 || eValid) && nDigit>0 ){ return -1; }else{ return 0; } #else Index: test/cast.test ================================================================== --- test/cast.test +++ test/cast.test @@ -428,7 +428,24 @@ DROP TABLE IF EXISTS t0; CREATE TABLE t0 (c0 TEXT); INSERT INTO t0(c0) VALUES ('1.0'); SELECT CAST(c0 AS NUMERIC) FROM t0; } {1} + +# 2019-06-10 +# https://sqlite.org/src/info/27de823723a41df45af3 +# +do_execsql_test cast-7.30 { + SELECT -'.'; +} 0 +do_execsql_test cast-7.31 { + SELECT '.'+0; +} 0 +do_execsql_test cast-7.32 { + SELECT CAST('.' AS numeric); +} 0 +do_execsql_test cast-7.33 { + SELECT -CAST('.' AS numeric); +} 0 + finish_test