Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v1 1/1] sql: introduce literals for DECIMAL
@ 2021-10-26 10:27 Mergen Imeev via Tarantool-patches
  2021-11-03  9:55 ` Kirill Yukhin via Tarantool-patches
  0 siblings, 1 reply; 6+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-10-26 10:27 UTC (permalink / raw)
  To: kyukhin; +Cc: tarantool-patches

Part of #6356

@TarantoolBot document
Title: Literals for INTEGER, DECIMAL and DOUBLE

The rules for parsing numeric values have changed:
1) a value consisting of digits without decimal point and exponent will
be parsed as INTEGER;
2) a value consisting of digits and a decimal point will be parsed as
DECIMAL;
3) a value consisting of digits, containing an exponent and possibly
containing a decimal point, will be parsed as DOUBLE.
---
https://github.com/tarantool/tarantool/issues/6356
https://github.com/tarantool/tarantool/tree/imeevma/gh-6356-literals-for-decimal

 .../gh-6356-literals-for-decimal.md           |  4 +
 src/box/sql/expr.c                            | 31 ++++++
 src/box/sql/parse.y                           |  4 +
 src/box/sql/tokenize.c                        |  2 +-
 src/box/sql/vdbe.c                            | 12 +++
 src/box/sql/vdbe.h                            |  4 +
 src/box/sql/vdbeapi.c                         |  3 +
 src/box/sql/vdbeaux.c                         |  5 +
 test/sql-tap/cast.test.lua                    | 22 ++---
 test/sql-tap/check.test.lua                   |  2 +-
 test/sql-tap/decimal.test.lua                 | 54 ++++++++++-
 test/sql-tap/default.test.lua                 |  4 +-
 test/sql-tap/e_select1.test.lua               | 14 +--
 test/sql-tap/func.test.lua                    | 18 ++--
 test/sql-tap/func3.test.lua                   | 26 ++---
 .../gh-5364-define-bit-wise-rules.test.lua    |  8 +-
 ...-5756-implicit-cast-in-arithmetic.test.lua | 10 +-
 .../gh-6239-quote-with-double-arg.test.lua    |  2 +-
 test/sql-tap/index1.test.lua                  |  2 +-
 test/sql-tap/insert3.test.lua                 |  3 +-
 test/sql-tap/lua_sql.test.lua                 |  4 +-
 test/sql-tap/metatypes.test.lua               |  2 +-
 test/sql-tap/misc5.test.lua                   |  4 +-
 test/sql-tap/numcast.test.lua                 | 38 ++++----
 test/sql-tap/select1.test.lua                 |  4 +-
 test/sql-tap/select4.test.lua                 |  2 +-
 test/sql-tap/selectB.test.lua                 |  6 +-
 test/sql-tap/sort.test.lua                    |  2 +-
 test/sql-tap/tkt-9a8b09f8e6.test.lua          | 28 +++---
 test/sql-tap/tkt-a8a0d2996a.test.lua          |  2 +-
 test/sql-tap/types.test.lua                   |  2 +-
 test/sql-tap/uuid.test.lua                    | 10 +-
 test/sql-tap/whereA.test.lua                  |  2 +-
 test/sql-tap/whereG.test.lua                  | 10 +-
 test/sql-tap/with1.test.lua                   |  6 +-
 test/sql/boolean.result                       | 96 +++++++++----------
 test/sql/func-recreate.result                 |  2 +-
 test/sql/func-recreate.test.lua               |  2 +-
 test/sql/gh-3888-values-blob-assert.result    |  2 +-
 test/sql/integer-overflow.result              |  2 +-
 test/sql/integer-overflow.test.lua            |  2 +-
 test/sql/misc.result                          | 18 +++-
 test/sql/misc.test.lua                        |  2 +
 test/sql/types.result                         | 51 +++++-----
 test/sql/types.test.lua                       | 10 +-
 45 files changed, 335 insertions(+), 204 deletions(-)
 create mode 100644 changelogs/unreleased/gh-6356-literals-for-decimal.md

diff --git a/changelogs/unreleased/gh-6356-literals-for-decimal.md b/changelogs/unreleased/gh-6356-literals-for-decimal.md
new file mode 100644
index 000000000..24b8d7e40
--- /dev/null
+++ b/changelogs/unreleased/gh-6356-literals-for-decimal.md
@@ -0,0 +1,4 @@
+## feature/sql
+
+* A value consisting of digits and a decimal point is now parsed as
+  DECIMAL (gh-6456).
diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index ee21c1ede..9e635a0f8 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -3286,6 +3286,30 @@ codeReal(Vdbe * v, const char *z, int negateFlag, int iMem)
 	}
 }
 
+static void
+expr_code_dec(struct Parse *parser, struct Expr *expr, bool is_neg, int reg)
+{
+	const char *str = expr->u.zToken;
+	assert(str != NULL);
+	decimal_t *value = sqlDbMallocRawNN(sql_get(), sizeof(*value));
+	if (value == NULL)
+		goto error;
+	if (is_neg) {
+		decimal_t dec;
+		if (decimal_from_string(&dec, str) == NULL)
+			goto error;
+		decimal_minus(value, &dec);
+	} else if (decimal_from_string(value, str) == NULL) {
+		goto error;
+	}
+	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, (char *)value,
+		      P4_DEC);
+	return;
+error:
+	sqlDbFree(sql_get(), value);
+	parser->is_aborted = true;
+}
+
 /**
  * Generate an instruction that will put the integer describe by
  * text z[0..n-1] into register iMem.
@@ -3725,6 +3749,10 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 			sqlVdbeAddOp2(v, OP_Bool, op == TK_TRUE, target);
 			return target;
 		}
+	case TK_DECIMAL:{
+			expr_code_dec(pParse, pExpr, false, target);
+			return target;
+		}
 	case TK_FLOAT:{
 			assert(!ExprHasProperty(pExpr, EP_IntValue));
 			codeReal(v, pExpr->u.zToken, 0, target);
@@ -3884,6 +3912,9 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 				assert(!ExprHasProperty(pExpr, EP_IntValue));
 				codeReal(v, pLeft->u.zToken, 1, target);
 				return target;
+			} else if (pLeft->op == TK_DECIMAL) {
+				expr_code_dec(pParse, pLeft, true, target);
+				return target;
 			} else {
 				tempX.op = TK_INTEGER;
 				tempX.flags = EP_IntValue | EP_TokenOnly;
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 337df4916..ae480a5d1 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -994,6 +994,9 @@ idlist(A) ::= nm(Y). {
       case TK_FLOAT:
         p->type = FIELD_TYPE_DOUBLE;
         break;
+      case TK_DECIMAL:
+        p->type = FIELD_TYPE_DECIMAL;
+        break;
       case TK_TRUE:
       case TK_FALSE:
       case TK_UNKNOWN:
@@ -1071,6 +1074,7 @@ term(A) ::= STRING(X).     {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= FALSE(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= TRUE(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= UNKNOWN(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
+term(A) ::= DECIMAL(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 
 term(A) ::= INTEGER(X). {
   A.pExpr = sql_expr_new_dequoted(pParse->db, TK_INTEGER, &X);
diff --git a/src/box/sql/tokenize.c b/src/box/sql/tokenize.c
index 0899cf23e..b3cf8f6e6 100644
--- a/src/box/sql/tokenize.c
+++ b/src/box/sql/tokenize.c
@@ -343,7 +343,7 @@ sql_token(const char *z, int *type, bool *is_reserved)
 		if (z[i] == '.') {
 			while (sqlIsdigit(z[++i])) {
 			}
-			*type = TK_FLOAT;
+			*type = TK_DECIMAL;
 		}
 		if ((z[i] == 'e' || z[i] == 'E') &&
 		    (sqlIsdigit(z[i + 1])
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 44533fb3e..c70c1fb30 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -804,6 +804,18 @@ case OP_Real: {            /* same as TK_FLOAT, out2 */
 	break;
 }
 
+/**
+ * Opcode: Decimal * P2 * P4 *
+ * Synopsis: r[P2]=P4
+ *
+ * P4 is a pointer to a DECIMAL value. Write that value into register P2.
+ */
+case OP_Decimal: {            /* same as TK_DECIMAL, out2 */
+	pOut = vdbe_prepare_null_out(p, pOp->p2);
+	mem_set_dec(pOut, pOp->p4.dec);
+	break;
+}
+
 /* Opcode: String8 * P2 * P4 *
  * Synopsis: r[P2]='P4'
  *
diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h
index e40a1a0b3..121b86029 100644
--- a/src/box/sql/vdbe.h
+++ b/src/box/sql/vdbe.h
@@ -97,6 +97,8 @@ struct VdbeOp {
 		 * Information about ephemeral space field types and key parts.
 		 */
 		struct sql_space_info *space_info;
+		/** P4 contains address of decimal. */
+		decimal_t *dec;
 	} p4;
 #ifdef SQL_ENABLE_EXPLAIN_COMMENTS
 	char *zComment;		/* Comment to improve readability */
@@ -132,6 +134,8 @@ struct SubProgram {
 #define P4_COLLSEQ  (-3)	/* P4 is a pointer to a CollSeq structure */
 /** P4 is a pointer to a func structure. */
 #define P4_FUNC     (-4)
+/** P4 is a pointer to a decimal. */
+#define P4_DEC      (-5)
 #define P4_MEM      (-7)	/* P4 is a pointer to a Mem*    structure */
 #define P4_TRANSIENT  0		/* P4 is a pointer to a transient string */
 #define P4_REAL     (-9)	/* P4 is a 64-bit floating point value */
diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
index 115940227..22c6bd656 100644
--- a/src/box/sql/vdbeapi.c
+++ b/src/box/sql/vdbeapi.c
@@ -563,6 +563,9 @@ sql_stmt_est_size(const struct sql_stmt *stmt)
 		case P4_REAL:
 			size += sizeof(*v->aOp[i].p4.pReal);
 			break;
+		case P4_DEC:
+			size += sizeof(*v->aOp[i].p4.dec);
+			break;
 		default:
 			size += sizeof(v->aOp[i].p4.p);
 			break;
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index 8148ed8b0..4ce08359c 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -605,6 +605,7 @@ freeP4(sql * db, int p4type, void *p4)
 			freeP4FuncCtx(db, (sql_context *) p4);
 			break;
 		}
+	case P4_DEC:
 	case P4_REAL:
 	case P4_INT64:
 	case P4_UINT64:
@@ -1095,6 +1096,10 @@ displayP4(Op * pOp, char *zTemp, int nTemp)
 			sqlXPrintf(&x, "%.16g", *pOp->p4.pReal);
 			break;
 		}
+	case P4_DEC:{
+			sqlXPrintf(&x, "%s", decimal_str(pOp->p4.dec));
+			break;
+		}
 	case P4_MEM:{
 			const char *value = mem_str(pOp->p4.pMem);
 			sqlStrAccumAppend(&x, value, strlen(value));
diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
index 68d2ae585..d5c9cbbc6 100755
--- a/test/sql-tap/cast.test.lua
+++ b/test/sql-tap/cast.test.lua
@@ -307,7 +307,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.31",
     [[
-        SELECT 123.456
+        SELECT 123.456e0
     ]], {
         -- <cast-1.31>
         123.456
@@ -317,7 +317,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.32",
     [[
-        SELECT typeof(123.456)
+        SELECT typeof(123.456e0)
     ]], {
         -- <cast-1.32>
         "double"
@@ -337,7 +337,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.34",
     [[
-        SELECT typeof(CAST(123.456 AS text))
+        SELECT typeof(CAST(123.456e0 AS text))
     ]], {
         -- <cast-1.34>
         "string"
@@ -347,7 +347,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.35",
     [[
-        SELECT CAST(123.456 AS NUMBER)
+        SELECT CAST(123.456e0 AS NUMBER)
     ]], {
         -- <cast-1.35>
         123.456
@@ -357,7 +357,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.36",
     [[
-        SELECT typeof(CAST(123.456 AS DOUBLE))
+        SELECT typeof(CAST(123.456e0 AS DOUBLE))
     ]], {
         -- <cast-1.36>
         "double"
@@ -367,7 +367,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.37",
     [[
-        SELECT CAST(123.456 AS SCALAR)
+        SELECT CAST(123.456e0 AS SCALAR)
     ]], {
         -- <cast-1.37>
         123.456
@@ -377,7 +377,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.38",
     [[
-        SELECT typeof(CAST(123.456 AS SCALAR))
+        SELECT typeof(CAST(123.456e0 AS SCALAR))
     ]], {
         -- <cast-1.38>
         "scalar"
@@ -387,7 +387,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.39",
     [[
-        SELECT CAST(123.456 AS integer)
+        SELECT CAST(123.456e0 AS integer)
     ]], {
         -- <cast-1.39>
         123
@@ -397,7 +397,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.38",
     [[
-        SELECT typeof(CAST(123.456 AS integer))
+        SELECT typeof(CAST(123.456e0 AS integer))
     ]], {
         -- <cast-1.38>
         "integer"
@@ -962,7 +962,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-6.2.3",
     [[
-        SELECT CAST(1.5 AS BOOLEAN);
+        SELECT CAST(1.5e0 AS BOOLEAN);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to boolean"
     })
@@ -1139,7 +1139,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-10.4",
     [[
-        SELECT '1' < 2.5;
+        SELECT '1' < 2.5e0;
     ]], {
         1, "Type mismatch: can not convert double(2.5) to string"
     })
diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua
index f8dcb7f7b..6c0707f6b 100755
--- a/test/sql-tap/check.test.lua
+++ b/test/sql-tap/check.test.lua
@@ -207,7 +207,7 @@ test:do_execsql_test(
         CREATE TABLE t2(
           id  INT primary key,
           x SCALAR CONSTRAINT one CHECK( typeof(coalesce(x,0))=='integer'),
-          y DOUBLE CONSTRAINT two CHECK( typeof(coalesce(y,0.1))=='double' ),
+          y DOUBLE CONSTRAINT two CHECK( typeof(coalesce(y,0.1e0))=='double' ),
           z SCALAR CONSTRAINT three CHECK( typeof(coalesce(z,''))=='string' )
         );
     ]], {
diff --git a/test/sql-tap/decimal.test.lua b/test/sql-tap/decimal.test.lua
index d422533d6..a6d66b75b 100755
--- a/test/sql-tap/decimal.test.lua
+++ b/test/sql-tap/decimal.test.lua
@@ -3,7 +3,7 @@ local build_path = os.getenv("BUILDDIR")
 package.cpath = build_path..'/test/sql-tap/?.so;'..build_path..'/test/sql-tap/?.dylib;'..package.cpath
 
 local test = require("sqltester")
-test:plan(104)
+test:plan(109)
 
 local dec = require("decimal")
 local dec1 = dec.new("111")
@@ -684,7 +684,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "dec-11.2.4",
     [[
-        INSERT INTO tsu VALUES ('4_double', 1.5);
+        INSERT INTO tsu VALUES ('4_double', 1.5e0);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -819,7 +819,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "dec-14.1.3",
     [[
-        SELECT u - 0.5 FROM t2;
+        SELECT u - 0.5e0 FROM t2;
     ]], {
         110.5, 3332.5, 55554.5
     })
@@ -835,7 +835,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "dec-14.1.5",
     [[
-        SELECT u / 1.0 FROM t2;
+        SELECT u / 1e0 FROM t2;
     ]], {
         111, 3333, 55555
     })
@@ -972,4 +972,50 @@ test:execsql([[
     DROP TABLE t1;
 ]])
 
+--
+-- gh-6356: Make sure that numeric literals with a decimal point and no exponent
+-- are treated as DECIMAL.
+--
+test:do_execsql_test(
+    "dec-17.1",
+    [[
+        SELECT 1.0, typeof(1.0);
+    ]], {
+        dec.new(1), 'decimal'
+    })
+
+test:do_test(
+    "dec-17.2",
+    function()
+        return box.execute([[SELECT 1.0;]]).metadata
+    end, {
+        {name = "COLUMN_1", type = "decimal"}
+    })
+
+test:do_execsql_test(
+    "dec-17.3",
+    [[
+        SELECT typeof(1), typeof(1e0), typeof(1.0);
+    ]], {
+        "integer", "double", "decimal"
+    })
+
+test:do_execsql_test(
+    "dec-17.4",
+    [[
+        SELECT 999999999999999999999999999999999999.9;
+    ]], {
+        dec.new('999999999999999999999999999999999999.9')
+    })
+
+-- Make sure that large number without a decimal point is not parsed as DECIMAL.
+test:do_catchsql_test(
+    "dec-17.5",
+    [[
+        SELECT 999999999999999999999999999999999999;
+    ]], {
+        1, [[Integer literal 999999999999999999999999999999999999 exceeds ]]..
+           "the supported range [-9223372036854775808, 18446744073709551615]"
+    })
+
 test:finish_test()
diff --git a/test/sql-tap/default.test.lua b/test/sql-tap/default.test.lua
index 9c15220eb..da911c61b 100755
--- a/test/sql-tap/default.test.lua
+++ b/test/sql-tap/default.test.lua
@@ -105,11 +105,11 @@ test:do_execsql_test(
 	b INT DEFAULT 12345 UNIQUE NOT NULL CHECK( b>=0 AND b<99999 ),
 	c VARCHAR(123) DEFAULT 'hello' NOT NULL,
 	d NUMBER,
-	e NUMBER DEFAULT 4.36,
+	e NUMBER DEFAULT 4.36e0,
 	f VARCHAR(15), --COLLATE RTRIM,
 	g INTEGER DEFAULT( 3600*12 )
 	);
-	INSERT INTO t3 VALUES(null, 5, 'row1', 5.25, 8.67, '321', 432);
+	INSERT INTO t3 VALUES(null, 5, 'row1', 5.25e0, 8.67e0, '321', 432);
 	SELECT a, typeof(a), b, typeof(b), c, typeof(c),
 	d, typeof(d), e, typeof(e), f, typeof(f),
 	g, typeof(g) FROM t3;
diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
index 9f10994ae..f78e2de7d 100755
--- a/test/sql-tap/e_select1.test.lua
+++ b/test/sql-tap/e_select1.test.lua
@@ -327,7 +327,7 @@ test:do_execsql_test(
     "e_select-1.4.0",
     [[
         CREATE TABLE x1(id  INT primary key, a TEXT , b TEXT );
-        CREATE TABLE x2(id  INT primary key, c NUMBER , d NUMBER , e NUMBER );
+        CREATE TABLE x2(id  INT primary key, c DOUBLE, d DOUBLE, e DOUBLE);
         CREATE TABLE x3(id  INT primary key, f TEXT , g TEXT , h TEXT , i TEXT );
 
         -- x1: 3 rows, 2 columns
@@ -1482,8 +1482,8 @@ test:drop_all_tables()
 test:do_execsql_test(
     "e_select-7.4.0",
     [[
-        CREATE TABLE q1(id  INT primary key, a TEXT, b NUMBER, c NUMBER);
-        CREATE TABLE q2(id  INT primary key, d TEXT, e NUMBER);
+        CREATE TABLE q1(id  INT primary key, a TEXT, b DOUBLE, c DOUBLE);
+        CREATE TABLE q2(id  INT primary key, d TEXT, e DOUBLE);
         CREATE TABLE q3(id  INT primary key, f TEXT, g INT);
 
         INSERT INTO q1 VALUES(1, '16', -87.66, NULL);
@@ -1632,7 +1632,7 @@ test:drop_all_tables()
 test:do_execsql_test(
     "e_select-7.10.0",
     [[
-        CREATE TABLE w1(a TEXT PRIMARY KEY, b NUMBER);
+        CREATE TABLE w1(a TEXT PRIMARY KEY, b DOUBLE);
         CREATE TABLE w2(a  INT PRIMARY KEY, b TEXT);
 
         INSERT INTO w1 VALUES('1', 4.1);
@@ -1908,7 +1908,7 @@ test:do_select_tests(
 test:do_execsql_test(
     "e_select-8.8.0",
     [[
-        CREATE TABLE d3(id  INT primary key, a NUMBER);
+        CREATE TABLE d3(id  INT primary key, a DOUBLE);
         INSERT INTO d3 VALUES(1, 0);
         INSERT INTO d3 VALUES(2, 14.1);
         INSERT INTO d3 VALUES(3, 13);
@@ -2193,7 +2193,7 @@ for _, val in ipairs({
     {"1", "SELECT b FROM f1 ORDER BY a LIMIT 'hello' "},
     {"2", "SELECT b FROM f1 ORDER BY a LIMIT NULL "},
     {"3", "SELECT b FROM f1 ORDER BY a LIMIT X'ABCD' "},
-    {"4", "SELECT b FROM f1 ORDER BY a LIMIT 5.1 "},
+    {"4", "SELECT b FROM f1 ORDER BY a LIMIT 5.1e0 "},
     {"5", "SELECT b FROM f1 ORDER BY a LIMIT (SELECT group_concat(b) FROM f1)"}}) do
     local tn = val[1]
     local select = val[2]
@@ -2248,7 +2248,7 @@ for _, val in ipairs({
     {1, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 'hello'"},
     {2, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET NULL"},
     {3, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET X'ABCD'"},
-    {4, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 5.1"},
+    {4, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 51e-1"},
     {5, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET (SELECT group_concat(b) FROM f1)"}}) do
     local tn = val[1]
     local select = val[2]
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index 416f27d69..29e1c3de2 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -678,7 +678,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func-4.35",
     [[
-        SELECT round(1234567890123.445,2);
+        SELECT round(1234567890123.445e0,2);
     ]], {
         -- <func-4.35>
         1234567890123.45
@@ -708,7 +708,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func-4.38",
     [[
-        SELECT round(9999999999999.556,2);
+        SELECT round(9999999999999.556e0, 2);
     ]], {
         -- <func-4.38>
         9999999999999.56
@@ -1497,7 +1497,7 @@ test:do_execsql_test(
     "func-18.12",
     [[
         INSERT INTO t6 VALUES(3, 1<<62);
-        SELECT sum(x) - ((1<<62)*2.0+1) from t6;
+        SELECT sum(x) - ((1 << 62) * 2e0 + 1) from t6;
     ]], {
         -- <func-18.12>
         0
@@ -2817,7 +2817,7 @@ test:do_execsql_test("func-77.1", "SELECT TOSTRING('1');", {'1'})
 test:do_execsql_test("func-77.2", "SELECT TOSTRING('a');", {'a'})
 test:do_catchsql_test("func-77.3", "SELECT TOSTRING(1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got unsigned"})
 test:do_catchsql_test("func-77.4", "SELECT TOSTRING(-1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got integer"})
-test:do_catchsql_test("func-77.5", "SELECT TOSTRING(-1.1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got double"})
+test:do_catchsql_test("func-77.5", "SELECT TOSTRING(-1.1e0);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got double"})
 test:do_catchsql_test("func-77.6", "SELECT TOSTRING(TRUE);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got boolean"})
 test:do_execsql_test("func-77.7", "SELECT TOSTRING(NULL);", {""})
 test:do_execsql_test("func-77.8", "SELECT TOSTRING(LUA('return nil'));", {""})
@@ -2837,7 +2837,7 @@ test:do_catchsql_test("func-78.1", "SELECT TOUNSIGNED('1');", {1, "Function 'TOU
 test:do_catchsql_test("func-78.2", "SELECT TOUNSIGNED('a');", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got string"})
 test:do_execsql_test("func-78.3", "SELECT TOUNSIGNED(1);", {1})
 test:do_catchsql_test("func-78.4", "SELECT TOUNSIGNED(-1);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got integer"})
-test:do_catchsql_test("func-78.5", "SELECT TOUNSIGNED(-1.1);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got double"})
+test:do_catchsql_test("func-78.5", "SELECT TOUNSIGNED(-1.1e0);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got double"})
 test:do_catchsql_test("func-78.6", "SELECT TOUNSIGNED(TRUE);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got boolean"})
 test:do_execsql_test("func-78.7", "SELECT TOUNSIGNED(NULL);", {""})
 test:do_execsql_test("func-78.8", "SELECT TOUNSIGNED(LUA('return nil'));", {""})
@@ -2857,7 +2857,7 @@ test:do_catchsql_test("func-79.1", "SELECT TOINTEGER('1');", {1, "Function 'TOIN
 test:do_catchsql_test("func-79.2", "SELECT TOINTEGER('a');", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got string"})
 test:do_execsql_test("func-79.3", "SELECT TOINTEGER(1);", {1})
 test:do_execsql_test("func-79.4", "SELECT TOINTEGER(-1);", {-1})
-test:do_catchsql_test("func-79.5", "SELECT TOINTEGER(-1.1);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got double"})
+test:do_catchsql_test("func-79.5", "SELECT TOINTEGER(-1.1e0);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got double"})
 test:do_catchsql_test("func-79.6", "SELECT TOINTEGER(TRUE);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got boolean"})
 test:do_execsql_test("func-79.7", "SELECT TOINTEGER(NULL);", {""})
 test:do_execsql_test("func-79.8", "SELECT TOINTEGER(LUA('return nil'));", {""})
@@ -2877,7 +2877,7 @@ test:do_catchsql_test("func-80.1", "SELECT TONUMBER('1');", {1, "Function 'TONUM
 test:do_catchsql_test("func-80.2", "SELECT TONUMBER('a');", {1, "Function 'TONUMBER' returned value of invalid type: expected number got string"})
 test:do_execsql_test("func-80.3", "SELECT TONUMBER(1);", {1})
 test:do_execsql_test("func-80.4", "SELECT TONUMBER(-1);", {-1})
-test:do_execsql_test("func-80.5", "SELECT TONUMBER(-1.1);", {-1.1})
+test:do_execsql_test("func-80.5", "SELECT TONUMBER(-1.1e0);", {-1.1})
 test:do_catchsql_test("func-80.6", "SELECT TONUMBER(TRUE);", {1, "Function 'TONUMBER' returned value of invalid type: expected number got boolean"})
 test:do_execsql_test("func-80.7", "SELECT TONUMBER(NULL);", {""})
 test:do_execsql_test("func-80.8", "SELECT TONUMBER(LUA('return nil'));", {""})
@@ -2897,7 +2897,7 @@ test:do_catchsql_test("func-81.1", "SELECT TOBOOLEAN('1');", {1, "Function 'TOBO
 test:do_catchsql_test("func-81.2", "SELECT TOBOOLEAN('a');", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got string"})
 test:do_catchsql_test("func-81.3", "SELECT TOBOOLEAN(1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got unsigned"})
 test:do_catchsql_test("func-81.4", "SELECT TOBOOLEAN(-1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got integer"})
-test:do_catchsql_test("func-81.5", "SELECT TOBOOLEAN(-1.1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got double"})
+test:do_catchsql_test("func-81.5", "SELECT TOBOOLEAN(-1.1e0);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got double"})
 test:do_execsql_test("func-81.6", "SELECT TOBOOLEAN(TRUE);", {true})
 test:do_execsql_test("func-81.7", "SELECT TOBOOLEAN(NULL);", {""})
 test:do_execsql_test("func-81.8", "SELECT TOBOOLEAN(LUA('return nil'));", {""})
@@ -2917,7 +2917,7 @@ test:do_execsql_test("func-82.1", "SELECT TOSCALAR('1');", {'1'})
 test:do_execsql_test("func-82.2", "SELECT TOSCALAR('a');", {'a'})
 test:do_execsql_test("func-82.3", "SELECT TOSCALAR(1);", {1})
 test:do_execsql_test("func-82.4", "SELECT TOSCALAR(-1);", {-1})
-test:do_execsql_test("func-82.5", "SELECT TOSCALAR(-1.1);", {-1.1})
+test:do_execsql_test("func-82.5", "SELECT TOSCALAR(-1.1e0);", {-1.1})
 test:do_execsql_test("func-82.6", "SELECT TOSCALAR(TRUE);", {true})
 test:do_execsql_test("func-82.7", "SELECT TOSCALAR(NULL);", {""})
 test:do_execsql_test("func-82.8", "SELECT TOSCALAR(LUA('return nil'));", {""})
diff --git a/test/sql-tap/func3.test.lua b/test/sql-tap/func3.test.lua
index 7f1d8d33c..8d6268bb7 100755
--- a/test/sql-tap/func3.test.lua
+++ b/test/sql-tap/func3.test.lua
@@ -28,7 +28,7 @@ test:plan(35)
 test:do_execsql_test(
     "func3-5.1",
     [[
-        SELECT likelihood(9223372036854775807, 0.5);
+        SELECT likelihood(9223372036854775807, 0.5e0);
     ]], {
         -- <func3-5.1>
         9223372036854775807LL
@@ -38,7 +38,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.2",
     [[
-        SELECT likelihood(-9223372036854775808, 0.5);
+        SELECT likelihood(-9223372036854775808, 0.5e0);
     ]], {
         -- <func3-5.2>
         -9223372036854775808LL
@@ -48,7 +48,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.3",
     [[
-        SELECT likelihood(14.125, 0.5);
+        SELECT likelihood(14.125e0, 0.5e0);
     ]], {
         -- <func3-5.3>
         14.125
@@ -58,7 +58,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.4",
     [[
-        SELECT likelihood(NULL, 0.5);
+        SELECT likelihood(NULL, 0.5e0);
     ]], {
         -- <func3-5.4>
         ""
@@ -68,7 +68,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.5",
     [[
-        SELECT likelihood('test-string', 0.5);
+        SELECT likelihood('test-string', 0.5e0);
     ]], {
         -- <func3-5.5>
         "test-string"
@@ -78,7 +78,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.6",
     [[
-        SELECT quote(likelihood(x'010203000405', 0.5));
+        SELECT quote(likelihood(x'010203000405', 0.5e0));
     ]], {
         -- <func3-5.6>
         "X'010203000405'"
@@ -91,7 +91,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.7",
     [[
-        SELECT likelihood(123, 1.0), likelihood(456, 0.0);
+        SELECT likelihood(123, 1e0), likelihood(456, 0e0);
     ]], {
         -- <func3-5.7>
         123, 456
@@ -101,7 +101,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "func3-5.8",
     [[
-        SELECT likelihood(123, 1.000001);
+        SELECT likelihood(123, 1.000001e0);
     ]], {
         -- <func3-5.8>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -111,7 +111,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "func3-5.9",
     [[
-        SELECT likelihood(123, -0.000001);
+        SELECT likelihood(123, -0.000001e0);
     ]], {
         -- <func3-5.9>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -121,7 +121,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "func3-5.10",
     [[
-        SELECT likelihood(123, 0.5+0.3);
+        SELECT likelihood(123, 0.5e0 + 0.3e0);
     ]], {
         -- <func3-5.10>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -135,7 +135,7 @@ test:do_catchsql_test(
 test:do_test(
     "func3-5.20",
     function()
-        return test:execsql "EXPLAIN SELECT likelihood(LEAST(1.0+'2.0',4*11), 0.5)"
+        return test:execsql "EXPLAIN SELECT likelihood(LEAST(1.0+'2.0',4*11), 0.5e0)"
     end, test:execsql("EXPLAIN SELECT LEAST(1.0+'2.0',4*11)"))
 
 -- EVIDENCE-OF: R-11152-23456 The unlikely(X) function returns the
@@ -164,7 +164,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.32",
     [[
-        SELECT unlikely(14.125);
+        SELECT unlikely(14.125e0);
     ]], {
         -- <func3-5.32>
         14.125
@@ -237,7 +237,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.52",
     [[
-        SELECT likely(14.125);
+        SELECT likely(14.125e0);
     ]], {
         -- <func3-5.52>
         14.125
diff --git a/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua b/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
index 37bf62487..2a6a60a81 100755
--- a/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
+++ b/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
@@ -25,7 +25,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-1.3",
     [[
-        SELECT 9 >> 2.0;
+        SELECT 9 >> 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -82,7 +82,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-2.3",
     [[
-        SELECT 9 << 2.0;
+        SELECT 9 << 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -139,7 +139,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-3.3",
     [[
-        SELECT 9 & 2.0;
+        SELECT 9 & 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -196,7 +196,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-4.3",
     [[
-        SELECT 9 | 2.0;
+        SELECT 9 | 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
diff --git a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
index 390a2d9b2..bf636a261 100755
--- a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
+++ b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
@@ -25,7 +25,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-1.3",
     [[
-        SELECT 9 + 2.0;
+        SELECT 9 + 2e0;
     ]], {
         11
     })
@@ -82,7 +82,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-2.3",
     [[
-        SELECT 9 - 2.0;
+        SELECT 9 - 2e0;
     ]], {
         7
     })
@@ -139,7 +139,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-3.3",
     [[
-        SELECT 9 * 2.0;
+        SELECT 9 * 2e0;
     ]], {
         18
     })
@@ -196,7 +196,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-4.3",
     [[
-        SELECT 9 / 2.0;
+        SELECT 9 / 2e0;
     ]], {
         4.5
     })
@@ -253,7 +253,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "gh-5756-5.3",
     [[
-        SELECT 9 % 2.0;
+        SELECT 9 % 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to integer"
     })
diff --git a/test/sql-tap/gh-6239-quote-with-double-arg.test.lua b/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
index dab12253e..2642d799b 100755
--- a/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
+++ b/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
@@ -6,7 +6,7 @@ test:plan(1)
 test:do_execsql_test(
     "gh-6239",
     [[
-        SELECT QUOTE(1.5), TYPEOF(QUOTE(1.5));
+        SELECT QUOTE(1.5e0), TYPEOF(QUOTE(1.5e0));
     ]], {
         1.5, "double"
     })
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index 3230556d1..3879481df 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -598,7 +598,7 @@ end
 test:do_execsql_test(
     "index-12.1",
     [[
-        CREATE TABLE t4(id  INT primary key, a NUMBER,b INT );
+        CREATE TABLE t4(id INT primary key, a DOUBLE, b INT );
         INSERT INTO t4 VALUES(1, 0.0, 1);
         INSERT INTO t4 VALUES(2, 0.00, 2);
         INSERT INTO t4 VALUES(4, -1.0, 4);
diff --git a/test/sql-tap/insert3.test.lua b/test/sql-tap/insert3.test.lua
index 062fb1e33..3547122f0 100755
--- a/test/sql-tap/insert3.test.lua
+++ b/test/sql-tap/insert3.test.lua
@@ -236,7 +236,8 @@ test:do_execsql_test(
 test:do_execsql_test(
     "insert3-3.7",
     [[
-            CREATE TABLE t6(id INTEGER PRIMARY KEY AUTOINCREMENT, x INT ,y NUMBER DEFAULT 4.3, z TEXT DEFAULT 'hi');
+            CREATE TABLE t6(id INTEGER PRIMARY KEY AUTOINCREMENT, x INT,
+                            y DOUBLE DEFAULT 4.3, z TEXT DEFAULT 'hi');
             INSERT INTO t6 DEFAULT VALUES;
             SELECT * FROM t6;
     ]], {
diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
index 993417414..d2dd6b679 100755
--- a/test/sql-tap/lua_sql.test.lua
+++ b/test/sql-tap/lua_sql.test.lua
@@ -39,8 +39,8 @@ test:do_catchsql_test(
 for _, val in ipairs({
         {1, "'val'", "val"},
         {2, 1, 1},
-        {3, "1.0", 1},
-        {4, 1.5, 1.5},
+        {3, "1.0e0", 1},
+        {4, 1.5, require('decimal').new(1.5)},
     }) do
     local tn = val[1]
     local param = val[2]
diff --git a/test/sql-tap/metatypes.test.lua b/test/sql-tap/metatypes.test.lua
index 3e4091675..dfa5bbab4 100755
--- a/test/sql-tap/metatypes.test.lua
+++ b/test/sql-tap/metatypes.test.lua
@@ -14,7 +14,7 @@ test:do_execsql_test(
     "metatypes-1.1",
     [[
         INSERT INTO t VALUES(1, 1, 1);
-        INSERT INTO t VALUES(2, 2.0, 2.0);
+        INSERT INTO t VALUES(2, 2e0, 2e0);
         INSERT INTO t(i, s) VALUES(3, '3');
         INSERT INTO t(i, s) VALUES(4, true);
         INSERT INTO t(i, s) VALUES(5, x'35');
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 38eddfc64..159bccd8f 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -217,7 +217,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.1",
     [[
-        SELECT .1
+        SELECT 0.1e0
     ]], {
         -- <misc5-5.1>
         0.1
@@ -227,7 +227,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.2",
     [[
-        SELECT 2.
+        SELECT 2e0
     ]], {
         -- <misc5-5.2>
         2.0
diff --git a/test/sql-tap/numcast.test.lua b/test/sql-tap/numcast.test.lua
index 763708d76..62ea9e695 100755
--- a/test/sql-tap/numcast.test.lua
+++ b/test/sql-tap/numcast.test.lua
@@ -2,6 +2,8 @@
 local test = require("sqltester")
 test:plan(26)
 
+local dec = require('decimal')
+
 --!./tcltestrunner.lua
 -- 2013 March 20
 --
@@ -33,11 +35,11 @@ for _, enc in ipairs({"utf8"}) do
             return x
         end, enc)
     local data = {
-        {"1", "12345.0", 12345.0, 12345},
+        {"1", "12345.0", dec.new(12345.0), 12345},
         {"2", "12345.0e0", 12345.0, 12345},
         {"3", "-12345.0e0", -12345.0, -12345},
-        {"4", "-12345.25", -12345.25, -12345},
-        {"5", "-12345.0", -12345.0, -12345},
+        {"4", "-12345.25", dec.new(-12345.25), -12345},
+        {"5", "-12345.0", dec.new(-12345.0), -12345},
     }
     for _, val in ipairs(data) do
         local idx = val[1]
@@ -71,7 +73,7 @@ end
 test:do_execsql_test(
     "cast-2.1",
     [[
-        SELECT CAST((9223372036854775297.01) AS INTEGER);
+        SELECT CAST((9223372036854775297.01e0) AS INTEGER);
     ]], {
         9223372036854775808ULL
     })
@@ -79,7 +81,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.2",
     [[
-        SELECT CAST((18000000000000000000.) AS INTEGER);
+        SELECT CAST((18000000000000000000e0) AS INTEGER);
     ]], {
         18000000000000000000ULL
     })
@@ -87,7 +89,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.3",
     [[
-        SELECT CAST((9223372036854775297.01) AS UNSIGNED);
+        SELECT CAST((9223372036854775297.01e0) AS UNSIGNED);
     ]], {
         9223372036854775808ULL
     })
@@ -95,7 +97,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.4",
     [[
-        SELECT CAST((18000000000000000000.) AS UNSIGNED);
+        SELECT CAST((18000000000000000000e0) AS UNSIGNED);
     ]], {
         18000000000000000000ULL
     })
@@ -103,7 +105,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "cast-2.5",
     [[
-        SELECT CAST((20000000000000000000.) AS UNSIGNED);
+        SELECT CAST((20000000000000000000e0) AS UNSIGNED);
     ]], {
         1,"Type mismatch: can not convert double(2.0e+19) to unsigned"
     })
@@ -112,7 +114,7 @@ test:do_execsql_test(
     "cast-2.6",
     [[
         CREATE TABLE t (i INTEGER PRIMARY KEY);
-        INSERT INTO t VALUES(9223372036854775297.01);
+        INSERT INTO t VALUES(9223372036854775297.01e0);
         SELECT * FROM t;
     ]], {
         9223372036854775808ULL
@@ -121,7 +123,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.7",
     [[
-        INSERT INTO t VALUES(18000000000000000000.01);
+        INSERT INTO t VALUES(18000000000000000000.01e0);
         SELECT * FROM t;
     ]], {
         9223372036854775808ULL,18000000000000000000ULL
@@ -130,7 +132,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "cast-2.8",
     [[
-        INSERT INTO t VALUES(20000000000000000000.01);
+        INSERT INTO t VALUES(20000000000000000000.01e0);
         SELECT * FROM t;
     ]], {
         1,"Type mismatch: can not convert double(2.0e+19) to integer"
@@ -139,7 +141,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-2.9",
     [[
-        INSERT INTO t VALUES(2.1);
+        INSERT INTO t VALUES(2.1e0);
     ]], {
         1, "Type mismatch: can not convert double(2.1) to integer"
     })
@@ -147,7 +149,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "numcast-3.8",
     [[
-        SELECT (1 + 0) / 3, (1 + 0.) / 3, (1 + 0) / 3.;
+        SELECT (1 + 0) / 3, (1 + 0e0) / 3, (1 + 0) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -155,7 +157,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.9",
     [[
-        SELECT (1 - 0) / 3, (1 - 0.) / 3, (1 - 0) / 3.;
+        SELECT (1 - 0) / 3, (1 - 0e0) / 3, (1 - 0) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -163,7 +165,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.10",
     [[
-        SELECT (1 * 1) / 3, (1 * 1.) / 3, (1 * 1) / 3.;
+        SELECT (1 * 1) / 3, (1 * 1e0) / 3, (1 * 1) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -171,7 +173,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.11",
     [[
-        SELECT (1 / 1) / 3, (1 / 1.) / 3, (1 / 1) / 3.;
+        SELECT (1 / 1) / 3, (1 / 1e0) / 3, (1 / 1) / 3e0;
     ]], {
         0 , 0.33333333333333, 0.33333333333333
 })
@@ -183,7 +185,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "numcast-4",
     [[
-        SELECT CAST(-2.5 AS UNSIGNED);
+        SELECT CAST(-2.5e0 AS UNSIGNED);
     ]], {
         1, "Type mismatch: can not convert double(-2.5) to unsigned"
 })
@@ -195,7 +197,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "numcast-5",
     [[
-        SELECT CAST(-0.999 AS INTEGER), CAST(-0.111 AS UNSIGNED);
+        SELECT CAST(-0.999e0 AS INTEGER), CAST(-0.111e0 AS UNSIGNED);
     ]], {
         0, 0
 })
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index e89c7d2f8..8164b8219 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1157,7 +1157,7 @@ test:do_test(
     function()
         set_full_column_names(true)
         return test:execsql2 [[
-            SELECT 123.45;
+            SELECT 123.45e0;
         ]]
     end, {
         -- <select1-6.9.5>
@@ -1481,7 +1481,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "select1-8.1",
     [[
-        SELECT f1 FROM test1 WHERE 4.3+2.4 OR 1 ORDER BY f1
+        SELECT f1 FROM test1 WHERE 4.3e0+2.4e0 OR 1 ORDER BY f1
     ]], {
         -- <select1-8.1>
         1, 'Type mismatch: can not convert double(6.7) to boolean'
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index 465800940..384641e08 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -759,7 +759,7 @@ test:do_test(
     "select4-8.1",
     function()
         test:execsql [[
-            CREATE TABLE t3(a text primary key, b NUMBER, c text);
+            CREATE TABLE t3(a text primary key, b DOUBLE, c text);
             START TRANSACTION;
             INSERT INTO t3 VALUES('1', 1.1, '1.1');
             INSERT INTO t3 VALUES('2', 1.10, '1.10');
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index 88f108f57..f5bd75cb8 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -443,7 +443,7 @@ for ii = 3, 6, 1 do
             SELECT x, y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) ORDER BY 1;
@@ -457,7 +457,7 @@ for ii = 3, 6, 1 do
             SELECT x, y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 LEFT JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 LEFT JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) ORDER BY 1;
@@ -471,7 +471,7 @@ for ii = 3, 6, 1 do
             SELECT x+y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 LEFT JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 LEFT JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) WHERE y+x IS NOT NULL ORDER BY 1;
diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
index 68a0ecbd2..d3f32bfb6 100755
--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -632,7 +632,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "sort-8.1",
     [[
-        CREATE TABLE t5(a NUMBER, b text PRIMARY KEY);
+        CREATE TABLE t5(a DOUBLE, b text PRIMARY KEY);
         INSERT INTO t5 VALUES(100,'A1');
         INSERT INTO t5 VALUES(100.0,'A2');
         SELECT * FROM t5 ORDER BY a, b;
diff --git a/test/sql-tap/tkt-9a8b09f8e6.test.lua b/test/sql-tap/tkt-9a8b09f8e6.test.lua
index cc321c2f6..983c8df2a 100755
--- a/test/sql-tap/tkt-9a8b09f8e6.test.lua
+++ b/test/sql-tap/tkt-9a8b09f8e6.test.lua
@@ -46,7 +46,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.3,
     [[
-        CREATE TABLE t3(x NUMBER primary key);
+        CREATE TABLE t3(x DOUBLE primary key);
         INSERT INTO t3 VALUES(1.0);
     ]], {
         -- <1.3>
@@ -57,7 +57,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.4,
     [[
-        CREATE TABLE t4(x NUMBER primary key);
+        CREATE TABLE t4(x DOUBLE primary key);
         INSERT INTO t4 VALUES(1.11);
     ]], {
         -- <1.4>
@@ -92,7 +92,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     2.2,
     [[
-        SELECT x FROM t1 WHERE x IN (1.0);
+        SELECT x FROM t1 WHERE x IN (1e0);
     ]], {
         -- <2.2>
         1, "Type mismatch: can not convert double(1.0) to string"
@@ -132,7 +132,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     2.6,
     [[
-        SELECT x FROM t1 WHERE 1.0 IN (x);
+        SELECT x FROM t1 WHERE 1e0 IN (x);
     ]], {
         -- <2.6>
         1, "Type mismatch: can not convert double(1.0) to string"
@@ -225,7 +225,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE x IN ('1');
     ]], {
         -- <4.3>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </4.3>
     })
 
@@ -235,7 +235,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE x IN ('1.0');
     ]], {
         -- <4.4>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </4.4>
     })
 
@@ -265,7 +265,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE '1' IN (x);
     ]], {
         -- <4.7>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </4.7>
     })
 
@@ -275,7 +275,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE '1.0' IN (x);
     ]], {
         -- <4.8>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </4.8>
     })
 
@@ -305,7 +305,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1');
     ]], {
         -- <5.3>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </5.3>
     })
 
@@ -315,7 +315,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1.0');
     ]], {
         -- <5.4>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </5.4>
     })
 
@@ -335,7 +335,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1.11');
     ]], {
         -- <5.6>
-        1, "Type mismatch: can not convert string('1.11') to number"
+        1, "Type mismatch: can not convert string('1.11') to double"
         -- </5.6>
     })
 
@@ -365,7 +365,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1' IN (x);
     ]], {
         -- <5.9>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </5.9>
     })
 
@@ -375,7 +375,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1.0' IN (x);
     ]], {
         -- <5.10>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </5.10>
     })
 
@@ -395,7 +395,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1.11' IN (x);
     ]], {
         -- <5.12>
-        1, "Type mismatch: can not convert string('1.11') to number"
+        1, "Type mismatch: can not convert string('1.11') to double"
         -- </5.12>
     })
 
diff --git a/test/sql-tap/tkt-a8a0d2996a.test.lua b/test/sql-tap/tkt-a8a0d2996a.test.lua
index a40621f41..37dc377a8 100755
--- a/test/sql-tap/tkt-a8a0d2996a.test.lua
+++ b/test/sql-tap/tkt-a8a0d2996a.test.lua
@@ -125,7 +125,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     4.0,
     [[
-        SELECT 1+1.;
+        SELECT 1+1e0;
     ]], {
         -- <4.0>
         2.0
diff --git a/test/sql-tap/types.test.lua b/test/sql-tap/types.test.lua
index 4e98e18b1..b86fb4db3 100755
--- a/test/sql-tap/types.test.lua
+++ b/test/sql-tap/types.test.lua
@@ -165,7 +165,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "types-2.2.1",
     [[
-        CREATE TABLE t2(id  INT primary key, a NUMBER);
+        CREATE TABLE t2(id  INT primary key, a DOUBLE);
         INSERT INTO t2 VALUES(1, 0.0);
         INSERT INTO t2 VALUES(2, 12345.678);
         INSERT INTO t2 VALUES(3, -12345.678);
diff --git a/test/sql-tap/uuid.test.lua b/test/sql-tap/uuid.test.lua
index fea9d9370..d6c53d123 100755
--- a/test/sql-tap/uuid.test.lua
+++ b/test/sql-tap/uuid.test.lua
@@ -339,7 +339,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "uuid-6.1.15",
     [[
-        SELECT LIKELIHOOD(u, 0.5) from t2;
+        SELECT LIKELIHOOD(u, 0.5e0) from t2;
     ]], {
         uuid1, uuid3, uuid2
     })
@@ -651,7 +651,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-7.2.4",
     [[
-        SELECT cast(1.5 AS UUID);
+        SELECT cast(1.5e0 AS UUID);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -804,7 +804,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-8.2.4",
     [[
-        INSERT INTO tsu VALUES ('4_double', 1.5);
+        INSERT INTO tsu VALUES ('4_double', 1.5e0);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -1098,7 +1098,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-13.1.4",
     [[
-        SELECT u > 1.5 FROM t2;
+        SELECT u > 1.5e0 FROM t2;
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -1162,7 +1162,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-13.2.4",
     [[
-        SELECT u = 1.5 FROM t2;
+        SELECT u = 1.5e0 FROM t2;
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index 58e5d3e0b..2c424454d 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -23,7 +23,7 @@ test:do_test(
     "whereA-1.1",
     function()
         return test:execsql [[
-            CREATE TABLE t1(a INTEGER PRIMARY KEY, b NUMBER UNIQUE, c TEXT);
+            CREATE TABLE t1(a INTEGER PRIMARY KEY, b DOUBLE UNIQUE, c TEXT);
             INSERT INTO t1 VALUES(1,2,'3');
             INSERT INTO t1 values(2,55,'world');
             INSERT INTO t1 VALUES(3,4.53,NULL);
diff --git a/test/sql-tap/whereG.test.lua b/test/sql-tap/whereG.test.lua
index 49501a4a5..8d91b7978 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -103,7 +103,7 @@ test:do_eqp_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', 0.5)
+         WHERE likelihood(cname LIKE '%bach%', 0.5e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -117,7 +117,7 @@ test:do_execsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%' COLLATE "unicode_ci", 0.5)
+         WHERE likelihood(cname LIKE '%bach%' COLLATE "unicode_ci", 0.5e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -187,7 +187,7 @@ test:do_catchsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', -0.01)
+         WHERE likelihood(cname LIKE '%bach%', -0.1e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -201,7 +201,7 @@ test:do_catchsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', 1.01)
+         WHERE likelihood(cname LIKE '%bach%', 1.01e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -370,7 +370,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "7.2",
     [[
-        SELECT likelihood(a,0.5), x FROM t1, t2 ORDER BY 1, 2;
+        SELECT likelihood(a, 0.5e0), x FROM t1, t2 ORDER BY 1, 2;
     ]], {
         -- <7.2>
         1, 3, 1, 4, 9, 3, 9, 4
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 761004b23..2aa9f0aca 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -534,10 +534,10 @@ test:do_catchsql_test(7.6, [[
 --
 test:do_execsql_test("8.1-mandelbrot", [[
   WITH RECURSIVE
-    xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2),
-    yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0),
+    xaxis(x) AS (VALUES(-2e0) UNION ALL SELECT x + 0.05e0 FROM xaxis WHERE x < 1.2e0),
+    yaxis(y) AS (VALUES(-1e0) UNION ALL SELECT y + 0.1e0 FROM yaxis WHERE y < 1.0e0),
     m(iter, cx, cy, x, y) AS (
-      SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis
+      SELECT 0, x, y, 0e0, 0e0 FROM xaxis, yaxis
       UNION ALL
       SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m
        WHERE (x*x + y*y) < 4.0 AND iter<28
diff --git a/test/sql/boolean.result b/test/sql/boolean.result
index 75a091cce..984529f64 100644
--- a/test/sql/boolean.result
+++ b/test/sql/boolean.result
@@ -546,12 +546,12 @@ SELECT cast(0 AS BOOLEAN);
 SELECT cast(0.123 AS BOOLEAN);
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.123) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.123) to boolean'
  | ...
 SELECT cast(0.0 AS BOOLEAN);
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.0) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.0) to boolean'
  | ...
 SELECT cast('true' AS BOOLEAN), cast('false' AS BOOLEAN);
  | ---
@@ -3920,7 +3920,7 @@ INSERT INTO t8 VALUES (4.56);
 SELECT true AND 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false AND 2.3;
  | ---
@@ -3933,17 +3933,17 @@ SELECT false AND 2.3;
 SELECT true OR 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false OR 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 AND true;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 AND false;
  | ---
@@ -3956,53 +3956,53 @@ SELECT 2.3 AND false;
 SELECT 2.3 OR true;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 OR false;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 
 SELECT a1, a1 AND 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 OR 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 AND a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 OR a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 AND 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 OR 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 AND a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 OR a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 
 SELECT c, true AND c FROM t8;
@@ -4140,12 +4140,12 @@ SELECT false / 2.3;
 SELECT true % 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT false % 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT 2.3 + true;
  | ---
@@ -4221,7 +4221,7 @@ SELECT a1, a1 / 2.3 FROM t6
 SELECT a1, a1 % 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT a1, 2.3 + a1 FROM t6
  | ---
@@ -4271,7 +4271,7 @@ SELECT a2, a2 / 2.3 FROM t6
 SELECT a2, a2 % 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT a2, 2.3 + a2 FROM t6
  | ---
@@ -4504,22 +4504,22 @@ SELECT a2, c, c % a2 FROM t6, t8;
 SELECT true > 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false > 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true < 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false < 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 > true;
  | ---
@@ -4545,12 +4545,12 @@ SELECT 2.3 < false;
 SELECT a1, a1 > 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 < 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 > a1 FROM t6
  | ---
@@ -4565,12 +4565,12 @@ SELECT a1, 2.3 < a1 FROM t6
 SELECT a2, a2 > 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 < 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 > a2 FROM t6
  | ---
@@ -4668,22 +4668,22 @@ SELECT a2, c, c < a2 FROM t6, t8;
 SELECT true >= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false >= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true <= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false <= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 >= true;
  | ---
@@ -4709,12 +4709,12 @@ SELECT 2.3 <= false;
 SELECT a1, a1 >= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 <= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 >= a1 FROM t6
  | ---
@@ -4729,12 +4729,12 @@ SELECT a1, 2.3 <= a1 FROM t6
 SELECT a2, a2 >= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 <= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 >= a2 FROM t6
  | ---
@@ -4832,22 +4832,22 @@ SELECT a2, c, c <= a2 FROM t6, t8;
 SELECT true == 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false == 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true != 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false != 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 == true;
  | ---
@@ -4873,12 +4873,12 @@ SELECT 2.3 != false;
 SELECT a1, a1 == 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 != 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 == a1 FROM t6
  | ---
@@ -4893,12 +4893,12 @@ SELECT a1, 2.3 != a1 FROM t6
 SELECT a2, a2 == 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 != 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 == a2 FROM t6
  | ---
@@ -5049,22 +5049,22 @@ SELECT a2 IN (SELECT c FROM t8) FROM t6 LIMIT 1;
 SELECT true BETWEEN 0.1 and 9.9;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT false BETWEEN 0.1 and 9.9;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT a1, a1 BETWEEN 0.1 and 9.9 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT a2, a2 BETWEEN 0.1 and 9.9 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 
 -- Check interaction of BOOLEAN and TEXT.
diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
index 5fd2b79c0..efc0a7493 100644
--- a/test/sql/func-recreate.result
+++ b/test/sql/func-recreate.result
@@ -25,7 +25,7 @@ test_run:cmd("setopt delimiter ''");
 ch = fiber.channel(1)
 ---
 ...
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2)')) end)
+_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2e0)')) end)
 ---
 ...
 fiber.sleep(0.1)
diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
index b76789f86..d0132f120 100644
--- a/test/sql/func-recreate.test.lua
+++ b/test/sql/func-recreate.test.lua
@@ -13,7 +13,7 @@ test_run:cmd("setopt delimiter ''");
 
 ch = fiber.channel(1)
 
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2)')) end)
+_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2e0)')) end)
 fiber.sleep(0.1)
 
 box.func.WAITFOR:drop()
diff --git a/test/sql/gh-3888-values-blob-assert.result b/test/sql/gh-3888-values-blob-assert.result
index 669f2eb2f..ce3f58cdc 100644
--- a/test/sql/gh-3888-values-blob-assert.result
+++ b/test/sql/gh-3888-values-blob-assert.result
@@ -69,7 +69,7 @@ box.execute('SELECT 3.14')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [3.14]
 ...
diff --git a/test/sql/integer-overflow.result b/test/sql/integer-overflow.result
index 8cad30ef3..91958d4e9 100644
--- a/test/sql/integer-overflow.result
+++ b/test/sql/integer-overflow.result
@@ -114,7 +114,7 @@ box.execute('SELECT CAST(\'18446744073709551616\' AS INTEGER);')
 -- float 18446744073709551600 -> int (18446744073709551616),
 -- with error due to conversion = 16.
 --
-box.execute('SELECT CAST(18446744073709551600. AS INTEGER);')
+box.execute('SELECT CAST(18446744073709551600e0 AS INTEGER);')
 ---
 - null
 - 'Type mismatch: can not convert double(1.84467440737096e+19) to integer'
diff --git a/test/sql/integer-overflow.test.lua b/test/sql/integer-overflow.test.lua
index 2ac97995a..5a9ebca19 100644
--- a/test/sql/integer-overflow.test.lua
+++ b/test/sql/integer-overflow.test.lua
@@ -32,7 +32,7 @@ box.execute('SELECT CAST(\'18446744073709551616\' AS INTEGER);')
 -- float 18446744073709551600 -> int (18446744073709551616),
 -- with error due to conversion = 16.
 --
-box.execute('SELECT CAST(18446744073709551600. AS INTEGER);')
+box.execute('SELECT CAST(18446744073709551600e0 AS INTEGER);')
 -- gh-3810: make sure that if space contains integers in range
 -- [INT64_MAX, UINT64_MAX], they are handled inside SQL in a
 -- proper way, which now means that an error is raised.
diff --git a/test/sql/misc.result b/test/sql/misc.result
index 91464ec33..c3c0b161b 100644
--- a/test/sql/misc.result
+++ b/test/sql/misc.result
@@ -87,12 +87,28 @@ box.execute('SELECT 1.5;')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [1.5]
 ...
 box.execute('SELECT 1.0;')
 ---
+- metadata:
+  - name: COLUMN_1
+    type: decimal
+  rows:
+  - [1.0]
+...
+box.execute('SELECT 1.5e0;')
+---
+- metadata:
+  - name: COLUMN_1
+    type: double
+  rows:
+  - [1.5]
+...
+box.execute('SELECT 1e0;')
+---
 - metadata:
   - name: COLUMN_1
     type: double
diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
index 8de7366b1..8b34d1071 100644
--- a/test/sql/misc.test.lua
+++ b/test/sql/misc.test.lua
@@ -24,6 +24,8 @@ box.execute('CREATE TABLE test (id INTEGER PRIMARY KEY, b TEXT CONSTRAINT c1 COL
 box.execute('SELECT 1;')
 box.execute('SELECT 1.5;')
 box.execute('SELECT 1.0;')
+box.execute('SELECT 1.5e0;')
+box.execute('SELECT 1e0;')
 box.execute('SELECT \'abc\';')
 box.execute('SELECT X\'4D6564766564\'')
 
diff --git a/test/sql/types.result b/test/sql/types.result
index b8e0d1fcb..947795b03 100644
--- a/test/sql/types.result
+++ b/test/sql/types.result
@@ -163,7 +163,7 @@ box.execute("SELECT 'abc' || 1;")
 box.execute("SELECT 'abc' || 1.123;")
 ---
 - null
-- 'Inconsistent types: expected string or varbinary got double(1.123)'
+- 'Inconsistent types: expected string or varbinary got decimal(1.123)'
 ...
 box.execute("SELECT 1 || 'abc';")
 ---
@@ -173,7 +173,7 @@ box.execute("SELECT 1 || 'abc';")
 box.execute("SELECT 1.123 || 'abc';")
 ---
 - null
-- 'Inconsistent types: expected string or varbinary got double(1.123)'
+- 'Inconsistent types: expected string or varbinary got decimal(1.123)'
 ...
 box.execute("SELECt 'a' || 'b' || 1;")
 ---
@@ -298,7 +298,7 @@ box.execute('SELECT 1 + 1.1;')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [2.1]
 ...
@@ -346,7 +346,7 @@ box.execute("SELECT * FROM tboolean WHERE s1 = 1;")
 box.execute("SELECT * FROM tboolean WHERE s1 = 1.123;")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to boolean'
+- 'Type mismatch: can not convert decimal(1.123) to boolean'
 ...
 box.space.TBOOLEAN:drop()
 ---
@@ -463,7 +463,8 @@ box.execute("SELECT a FROM t1 WHERE a IN (1.1, 2.1);")
 - metadata:
   - name: A
     type: unsigned
-  rows: []
+  rows:
+  - [1]
 ...
 s:drop()
 ---
@@ -582,7 +583,7 @@ box.execute("SELECT 18446744073709551615 = null;")
   rows:
   - [null]
 ...
-box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
+box.execute("SELECT 18446744073709551615 = 18446744073709551615e0;")
 ---
 - metadata:
   - name: COLUMN_1
@@ -590,7 +591,7 @@ box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
   rows:
   - [false]
 ...
-box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
+box.execute("SELECT 18446744073709551615e0 > 18446744073709551615")
 ---
 - metadata:
   - name: COLUMN_1
@@ -598,7 +599,7 @@ box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
   rows:
   - [true]
 ...
-box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615.0)")
+box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615e0)")
 ---
 - null
 - 'Type mismatch: can not convert integer(18446744073709551615) to string'
@@ -1075,7 +1076,7 @@ box.execute("SELECT CAST(1.5 AS UNSIGNED);")
 box.execute("SELECT CAST(-1.5 AS UNSIGNED);")
 ---
 - null
-- 'Type mismatch: can not convert double(-1.5) to unsigned'
+- 'Type mismatch: can not convert decimal(-1.5) to unsigned'
 ...
 box.execute("SELECT CAST(true AS UNSIGNED);")
 ---
@@ -1192,7 +1193,7 @@ box.execute("INSERT INTO t VALUES(1, 1);")
 box.execute("INSERT INTO t VALUES(1, 1.123);")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("INSERT INTO t VALUES(1, true);")
 ---
@@ -1216,7 +1217,7 @@ box.execute("SELECT * FROM t WHERE v = 1")
 box.execute("SELECT * FROM t WHERE v = 1.123")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("SELECT * FROM t WHERE v = 'str'")
 ---
@@ -1424,7 +1425,7 @@ box.execute("SELECT CAST(1 AS VARBINARY);")
 box.execute("SELECT CAST(1.123 AS VARBINARY);")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("SELECT CAST(true AS VARBINARY);")
 ---
@@ -1657,15 +1658,15 @@ box.execute("SELECT 1.0;")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
-  - [1]
+  - [1.0]
 ...
 box.execute("SELECT .01;")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [0.01]
 ...
@@ -2031,11 +2032,11 @@ box.execute("SELECT 1.0, typeof(1.0);")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   - name: COLUMN_2
     type: string
   rows:
-  - [1, 'double']
+  - [1.0, 'decimal']
 ...
 box.execute("SELECT CAST(2 AS DOUBLE), typeof(CAST(2 AS DOUBLE));")
 ---
@@ -2146,7 +2147,7 @@ box.execute([[INSERT INTO ti(i) VALUES (11);]])
   - 2
   row_count: 1
 ...
-box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1);]])
+box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1e0);]])
 ---
 - null
 - 'Type mismatch: can not convert double(1.0e+32) to integer'
@@ -2248,7 +2249,7 @@ box.execute([[INSERT INTO tb(b) VALUES (11);]])
 box.execute([[INSERT INTO tb(b) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to boolean'
+- 'Type mismatch: can not convert decimal(22.2) to boolean'
 ...
 box.execute([[INSERT INTO tb(b) VALUES (true);]])
 ---
@@ -2291,7 +2292,7 @@ box.execute([[INSERT INTO tt(t) VALUES (11);]])
 box.execute([[INSERT INTO tt(t) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to string'
+- 'Type mismatch: can not convert decimal(22.2) to string'
 ...
 box.execute([[INSERT INTO tt(t) VALUES (true);]])
 ---
@@ -2334,7 +2335,7 @@ box.execute([[INSERT INTO tv(v) VALUES (11);]])
 box.execute([[INSERT INTO tv(v) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to varbinary'
+- 'Type mismatch: can not convert decimal(22.2) to varbinary'
 ...
 box.execute([[INSERT INTO tv(v) VALUES (true);]])
 ---
@@ -2501,7 +2502,7 @@ box.execute([[UPDATE ti SET i = 11 WHERE a = 1;]])
 ---
 - row_count: 1
 ...
-box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1 WHERE a = 1;]])
+box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1e0 WHERE a = 1;]])
 ---
 - null
 - 'Type mismatch: can not convert double(1.0e+32) to integer'
@@ -2589,7 +2590,7 @@ box.execute([[UPDATE tb SET b = 11 WHERE a = 1;]])
 box.execute([[UPDATE tb SET b = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to boolean'
+- 'Type mismatch: can not convert decimal(22.2) to boolean'
 ...
 box.execute([[UPDATE tb SET b = true WHERE a = 1;]])
 ---
@@ -2627,7 +2628,7 @@ box.execute([[UPDATE tt SET t = 11 WHERE a = 1;]])
 box.execute([[UPDATE tt SET t = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to string'
+- 'Type mismatch: can not convert decimal(22.2) to string'
 ...
 box.execute([[UPDATE tt SET t = true WHERE a = 1;]])
 ---
@@ -2665,7 +2666,7 @@ box.execute([[UPDATE tv SET v = 11 WHERE a = 1;]])
 box.execute([[UPDATE tv SET v = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to varbinary'
+- 'Type mismatch: can not convert decimal(22.2) to varbinary'
 ...
 box.execute([[UPDATE tv SET v = true WHERE a = 1;]])
 ---
diff --git a/test/sql/types.test.lua b/test/sql/types.test.lua
index 0270d9f8a..e9b5012af 100644
--- a/test/sql/types.test.lua
+++ b/test/sql/types.test.lua
@@ -149,9 +149,9 @@ box.execute("SELECT -1 < 18446744073709551615;")
 box.execute("SELECT -1 > 18446744073709551615;")
 box.execute("SELECT 18446744073709551610 - 18446744073709551615;")
 box.execute("SELECT 18446744073709551615 = null;")
-box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
-box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
-box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615.0)")
+box.execute("SELECT 18446744073709551615 = 18446744073709551615e0;")
+box.execute("SELECT 18446744073709551615e0 > 18446744073709551615")
+box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615e0)")
 box.execute("SELECT 1 LIMIT 18446744073709551615;")
 box.execute("SELECT 1 LIMIT 1 OFFSET 18446744073709551614;")
 box.execute("SELECT CAST('18446744073' || '709551616' AS INTEGER);")
@@ -504,7 +504,7 @@ box.execute([[CREATE TABLE ts (a INT PRIMARY KEY AUTOINCREMENT, s SCALAR);]])
 
 box.execute([[INSERT INTO ti(i) VALUES (NULL);]])
 box.execute([[INSERT INTO ti(i) VALUES (11);]])
-box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1);]])
+box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1e0);]])
 box.execute([[INSERT INTO ti(i) VALUES (33.0);]])
 box.execute([[INSERT INTO ti(i) VALUES (true);]])
 box.execute([[INSERT INTO ti(i) VALUES ('33');]])
@@ -569,7 +569,7 @@ box.execute([[SELECT * FROM ti, td, tb, tt, tv, ts;]])
 
 box.execute([[UPDATE ti SET i = NULL WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = 11 WHERE a = 1;]])
-box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1 WHERE a = 1;]])
+box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1e0 WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = 33.0 WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = true WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = '33' WHERE a = 1;]])
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH v1 1/1] sql: introduce literals for DECIMAL
  2021-10-26 10:27 [Tarantool-patches] [PATCH v1 1/1] sql: introduce literals for DECIMAL Mergen Imeev via Tarantool-patches
@ 2021-11-03  9:55 ` Kirill Yukhin via Tarantool-patches
  0 siblings, 0 replies; 6+ messages in thread
From: Kirill Yukhin via Tarantool-patches @ 2021-11-03  9:55 UTC (permalink / raw)
  To: imeevma; +Cc: tarantool-patches

Hello,


On 26 окт 13:27, imeevma@tarantool.org wrote:
> Part of #6356
> 
> @TarantoolBot document
> Title: Literals for INTEGER, DECIMAL and DOUBLE
> 
> The rules for parsing numeric values have changed:
> 1) a value consisting of digits without decimal point and exponent will
> be parsed as INTEGER;
> 2) a value consisting of digits and a decimal point will be parsed as
> DECIMAL;
> 3) a value consisting of digits, containing an exponent and possibly
> containing a decimal point, will be parsed as DOUBLE.
> ---
> https://github.com/tarantool/tarantool/issues/6356
> https://github.com/tarantool/tarantool/tree/imeevma/gh-6356-literals-for-decimal

LGTM.

I've checked your patch into master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH v1 1/1] sql: introduce literals for DECIMAL
  2021-10-19  8:49   ` Mergen Imeev via Tarantool-patches
@ 2021-10-24 15:50     ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 0 replies; 6+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-10-24 15:50 UTC (permalink / raw)
  To: Mergen Imeev; +Cc: tarantool-patches

Hi! Thanks for the fixes!

LGTM.

>>> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
>>> index 44533fb3e..747fb608b 100644
>>> --- a/src/box/sql/vdbe.c
>>> +++ b/src/box/sql/vdbe.c
>>> @@ -804,6 +804,17 @@ case OP_Real: {            /* same as TK_FLOAT, out2 */
>>>  	break;
>>>  }
>>>  
>>> +/* Opcode: Decimal * P2 * P4 *
>>> + * Synopsis: r[P2]=P4
>>> + *
>>> + * P4 is a pointer to a DECIMAL value. Write that value into register P2.
>>> + */
>>> +case OP_Decimal: {            /* same as TK_DECIMAL, out2 */
>>
>> 2. Lets stick to our code style when write comments:
>> start them with /** out of functions, and not write them
>> on the same line as code.
>>
> Fixed.

Nope, it seems not.

>>> diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
>>> index 68d2ae585..5f8e885ce 100755
>>> --- a/test/sql-tap/cast.test.lua
>>> +++ b/test/sql-tap/cast.test.lua
>>> @@ -962,7 +962,7 @@ test:do_catchsql_test(
>>>  test:do_catchsql_test(
>>>      "cast-6.2.3",
>>>      [[
>>> -        SELECT CAST(1.5 AS BOOLEAN);
>>> +        SELECT CAST(15e-1 AS BOOLEAN);
>>
>> 5. Please, add some tests for so large numbers that only
>> DECIMAL would fit them. To prove that VDBE really uses
>> decimal for them.
>>
> Not sure if I got it right. At first we wanted to parse large numbers without
> decimal point and exponent as DECIMAL if they are not fit for INTEGER, but we
> decided to abandon this idea. Is that what you mean?

I mean just use large decimal numbers, which wouldn't fit into an INTEGER.
You define decimals as "A value consisting of digits and a decimal point".
My proposal was to test a huge number with a decimal point which would
be > UINT64_MAX. I see you got it correct in the new patch.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH v1 1/1] sql: introduce literals for DECIMAL
  2021-10-08 22:32 ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-10-19  8:49   ` Mergen Imeev via Tarantool-patches
  2021-10-24 15:50     ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 6+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-10-19  8:49 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

Hi! Thank you for the review! My answers, diff and new patch below.

On Sat, Oct 09, 2021 at 12:32:37AM +0200, Vladislav Shpilevoy wrote:
> Thanks for the patch!
> 
> See 5 comments below.
> 
> > diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
> > index ee21c1ede..2b156284c 100644
> > --- a/src/box/sql/expr.c
> > +++ b/src/box/sql/expr.c
> > @@ -3286,6 +3286,27 @@ codeReal(Vdbe * v, const char *z, int negateFlag, int iMem)
> >  	}
> >  }
> >  
> > +static void
> > +expr_code_dec(struct Parse *parser, struct Expr *expr, bool is_neg, int reg)
> > +{
> > +	const char *str = expr->u.zToken;
> > +	assert(str != NULL);
> > +	decimal_t dec;
> > +	if (is_neg)
> > +		str = tt_sprintf("-%s", str);
> > +	if (decimal_from_string(&dec, str) == NULL) {
> > +		parser->is_aborted = true;
> > +		return;
> > +	}
> > +	char *value = sqlDbMallocRawNN(sql_get(), sizeof(dec));
> > +	if (value == NULL) {
> > +		parser->is_aborted = true;
> > +		return;
> > +	}
> > +	memcpy(value, &dec, sizeof(dec));
> > +	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, value, P4_DEC);
> 
> 1. memcpy() is not needed. For the positive case for sure. For the
> negative too, but I didn't bench what is faster - tt_sprintf() or
> decimal_minus().
> 
Thank you! I applied your diff.

> ====================
> diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
> index 2b156284c..cce0e5030 100644
> --- a/src/box/sql/expr.c
> +++ b/src/box/sql/expr.c
> @@ -3291,20 +3291,22 @@ expr_code_dec(struct Parse *parser, struct Expr *expr, bool is_neg, int reg)
>  {
>  	const char *str = expr->u.zToken;
>  	assert(str != NULL);
> -	decimal_t dec;
> -	if (is_neg)
> -		str = tt_sprintf("-%s", str);
> -	if (decimal_from_string(&dec, str) == NULL) {
> -		parser->is_aborted = true;
> -		return;
> -	}
> -	char *value = sqlDbMallocRawNN(sql_get(), sizeof(dec));
> -	if (value == NULL) {
> -		parser->is_aborted = true;
> -		return;
> +	decimal_t *value = sqlDbMallocRawNN(sql_get(), sizeof(*value));
> +	if (value == NULL)
> +		goto error;
> +	if (is_neg) {
> +		decimal_t dec;
> +		if (decimal_from_string(&dec, str) == NULL)
> +			goto error;
> +		decimal_minus(value, &dec);
> +	} else if (decimal_from_string(value, str) == NULL) {
> +		goto error;
>  	}
> -	memcpy(value, &dec, sizeof(dec));
>  	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, value, P4_DEC);
> +	return;
> +error:
> +	sqlDbFree(sql_get(), value);
> +	parser->is_aborted = true;
>  }
> ====================
> 
> > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> > index 44533fb3e..747fb608b 100644
> > --- a/src/box/sql/vdbe.c
> > +++ b/src/box/sql/vdbe.c
> > @@ -804,6 +804,17 @@ case OP_Real: {            /* same as TK_FLOAT, out2 */
> >  	break;
> >  }
> >  
> > +/* Opcode: Decimal * P2 * P4 *
> > + * Synopsis: r[P2]=P4
> > + *
> > + * P4 is a pointer to a DECIMAL value. Write that value into register P2.
> > + */
> > +case OP_Decimal: {            /* same as TK_DECIMAL, out2 */
> 
> 2. Lets stick to our code style when write comments:
> start them with /** out of functions, and not write them
> on the same line as code.
> 
Fixed.

> > +	pOut = vdbe_prepare_null_out(p, pOp->p2);
> > +	mem_set_dec(pOut, pOp->p4.dec);
> > +	break;
> > +}
> > +
> >  /* Opcode: String8 * P2 * P4 *
> >   * Synopsis: r[P2]='P4'
> >   *
> > diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h
> > index e40a1a0b3..121b86029 100644
> > --- a/src/box/sql/vdbe.h
> > +++ b/src/box/sql/vdbe.h
> > @@ -97,6 +97,8 @@ struct VdbeOp {
> >  		 * Information about ephemeral space field types and key parts.
> >  		 */
> 
> 3. Not related to the patch, but wtf P4_REAL is stored by a
> pointer? 'double' is 8 bytes, it fits perfectly into this
> union. But instead it is copied onto the heap?! Could you
> please file a ticket to fix that and store it by value?
> 
Filled and issue:
https://github.com/tarantool/tarantool/issues/6531

In the issue added about INTEGER/UNSIGNED and size of prepared statement that is
affected by these changes.

> >  		struct sql_space_info *space_info;
> > +		/** P4 contains address of decimal. */
> > +		decimal_t *dec;
> >  	} p4;
> > diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
> > index 68d2ae585..5f8e885ce 100755
> > --- a/test/sql-tap/cast.test.lua
> > +++ b/test/sql-tap/cast.test.lua
> > @@ -962,7 +962,7 @@ test:do_catchsql_test(
> >  test:do_catchsql_test(
> >      "cast-6.2.3",
> >      [[
> > -        SELECT CAST(1.5 AS BOOLEAN);
> > +        SELECT CAST(15e-1 AS BOOLEAN);
> 
> 4. It might be more readable to use e0 ending everywhere.
> The numbers otherwise become unreadable.
> 
Fixed.

> 5. Please, add some tests for so large numbers that only
> DECIMAL would fit them. To prove that VDBE really uses
> decimal for them.
> 
Not sure if I got it right. At first we wanted to parse large numbers without
decimal point and exponent as DECIMAL if they are not fit for INTEGER, but we
decided to abandon this idea. Is that what you mean?

I added couple of tests with big numbers.

> Also need to ensure typeof() returns correct types depending
> on the literal.
Added.



Diff:

diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index 2b156284c..9e635a0f8 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -3291,20 +3291,23 @@ expr_code_dec(struct Parse *parser, struct Expr *expr, bool is_neg, int reg)
 {
 	const char *str = expr->u.zToken;
 	assert(str != NULL);
-	decimal_t dec;
-	if (is_neg)
-		str = tt_sprintf("-%s", str);
-	if (decimal_from_string(&dec, str) == NULL) {
-		parser->is_aborted = true;
-		return;
-	}
-	char *value = sqlDbMallocRawNN(sql_get(), sizeof(dec));
-	if (value == NULL) {
-		parser->is_aborted = true;
-		return;
-	}
-	memcpy(value, &dec, sizeof(dec));
-	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, value, P4_DEC);
+	decimal_t *value = sqlDbMallocRawNN(sql_get(), sizeof(*value));
+	if (value == NULL)
+		goto error;
+	if (is_neg) {
+		decimal_t dec;
+		if (decimal_from_string(&dec, str) == NULL)
+			goto error;
+		decimal_minus(value, &dec);
+	} else if (decimal_from_string(value, str) == NULL) {
+		goto error;
+	}
+	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, (char *)value,
+		      P4_DEC);
+	return;
+error:
+	sqlDbFree(sql_get(), value);
+	parser->is_aborted = true;
 }
 
 /**
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 747fb608b..c70c1fb30 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -804,7 +804,8 @@ case OP_Real: {            /* same as TK_FLOAT, out2 */
 	break;
 }
 
-/* Opcode: Decimal * P2 * P4 *
+/**
+ * Opcode: Decimal * P2 * P4 *
  * Synopsis: r[P2]=P4
  *
  * P4 is a pointer to a DECIMAL value. Write that value into register P2.
diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
index 5f8e885ce..d5c9cbbc6 100755
--- a/test/sql-tap/cast.test.lua
+++ b/test/sql-tap/cast.test.lua
@@ -962,7 +962,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-6.2.3",
     [[
-        SELECT CAST(15e-1 AS BOOLEAN);
+        SELECT CAST(1.5e0 AS BOOLEAN);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to boolean"
     })
@@ -1139,7 +1139,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-10.4",
     [[
-        SELECT '1' < 25e-1;
+        SELECT '1' < 2.5e0;
     ]], {
         1, "Type mismatch: can not convert double(2.5) to string"
     })
diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua
index 8fc1a0a45..6c0707f6b 100755
--- a/test/sql-tap/check.test.lua
+++ b/test/sql-tap/check.test.lua
@@ -207,7 +207,7 @@ test:do_execsql_test(
         CREATE TABLE t2(
           id  INT primary key,
           x SCALAR CONSTRAINT one CHECK( typeof(coalesce(x,0))=='integer'),
-          y DOUBLE CONSTRAINT two CHECK( typeof(coalesce(y,1e-1))=='double' ),
+          y DOUBLE CONSTRAINT two CHECK( typeof(coalesce(y,0.1e0))=='double' ),
           z SCALAR CONSTRAINT three CHECK( typeof(coalesce(z,''))=='string' )
         );
     ]], {
diff --git a/test/sql-tap/decimal.test.lua b/test/sql-tap/decimal.test.lua
index 586913e8c..a6d66b75b 100755
--- a/test/sql-tap/decimal.test.lua
+++ b/test/sql-tap/decimal.test.lua
@@ -3,7 +3,7 @@ local build_path = os.getenv("BUILDDIR")
 package.cpath = build_path..'/test/sql-tap/?.so;'..build_path..'/test/sql-tap/?.dylib;'..package.cpath
 
 local test = require("sqltester")
-test:plan(106)
+test:plan(109)
 
 local dec = require("decimal")
 local dec1 = dec.new("111")
@@ -684,7 +684,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "dec-11.2.4",
     [[
-        INSERT INTO tsu VALUES ('4_double', 15e-1);
+        INSERT INTO tsu VALUES ('4_double', 1.5e0);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -819,7 +819,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "dec-14.1.3",
     [[
-        SELECT u - 5e-1 FROM t2;
+        SELECT u - 0.5e0 FROM t2;
     ]], {
         110.5, 3332.5, 55554.5
     })
@@ -992,4 +992,30 @@ test:do_test(
         {name = "COLUMN_1", type = "decimal"}
     })
 
+test:do_execsql_test(
+    "dec-17.3",
+    [[
+        SELECT typeof(1), typeof(1e0), typeof(1.0);
+    ]], {
+        "integer", "double", "decimal"
+    })
+
+test:do_execsql_test(
+    "dec-17.4",
+    [[
+        SELECT 999999999999999999999999999999999999.9;
+    ]], {
+        dec.new('999999999999999999999999999999999999.9')
+    })
+
+-- Make sure that large number without a decimal point is not parsed as DECIMAL.
+test:do_catchsql_test(
+    "dec-17.5",
+    [[
+        SELECT 999999999999999999999999999999999999;
+    ]], {
+        1, [[Integer literal 999999999999999999999999999999999999 exceeds ]]..
+           "the supported range [-9223372036854775808, 18446744073709551615]"
+    })
+
 test:finish_test()
diff --git a/test/sql-tap/default.test.lua b/test/sql-tap/default.test.lua
index 039a1a92a..da911c61b 100755
--- a/test/sql-tap/default.test.lua
+++ b/test/sql-tap/default.test.lua
@@ -105,11 +105,11 @@ test:do_execsql_test(
 	b INT DEFAULT 12345 UNIQUE NOT NULL CHECK( b>=0 AND b<99999 ),
 	c VARCHAR(123) DEFAULT 'hello' NOT NULL,
 	d NUMBER,
-	e NUMBER DEFAULT 436e-2,
+	e NUMBER DEFAULT 4.36e0,
 	f VARCHAR(15), --COLLATE RTRIM,
 	g INTEGER DEFAULT( 3600*12 )
 	);
-	INSERT INTO t3 VALUES(null, 5, 'row1', 525e-2, 867e-2, '321', 432);
+	INSERT INTO t3 VALUES(null, 5, 'row1', 5.25e0, 8.67e0, '321', 432);
 	SELECT a, typeof(a), b, typeof(b), c, typeof(c),
 	d, typeof(d), e, typeof(e), f, typeof(f),
 	g, typeof(g) FROM t3;
diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
index f968afc50..f78e2de7d 100755
--- a/test/sql-tap/e_select1.test.lua
+++ b/test/sql-tap/e_select1.test.lua
@@ -2193,7 +2193,7 @@ for _, val in ipairs({
     {"1", "SELECT b FROM f1 ORDER BY a LIMIT 'hello' "},
     {"2", "SELECT b FROM f1 ORDER BY a LIMIT NULL "},
     {"3", "SELECT b FROM f1 ORDER BY a LIMIT X'ABCD' "},
-    {"4", "SELECT b FROM f1 ORDER BY a LIMIT 51e-1 "},
+    {"4", "SELECT b FROM f1 ORDER BY a LIMIT 5.1e0 "},
     {"5", "SELECT b FROM f1 ORDER BY a LIMIT (SELECT group_concat(b) FROM f1)"}}) do
     local tn = val[1]
     local select = val[2]
diff --git a/test/sql-tap/func3.test.lua b/test/sql-tap/func3.test.lua
index 549510360..8d6268bb7 100755
--- a/test/sql-tap/func3.test.lua
+++ b/test/sql-tap/func3.test.lua
@@ -28,7 +28,7 @@ test:plan(35)
 test:do_execsql_test(
     "func3-5.1",
     [[
-        SELECT likelihood(9223372036854775807, 5e-1);
+        SELECT likelihood(9223372036854775807, 0.5e0);
     ]], {
         -- <func3-5.1>
         9223372036854775807LL
@@ -38,7 +38,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.2",
     [[
-        SELECT likelihood(-9223372036854775808, 5e-1);
+        SELECT likelihood(-9223372036854775808, 0.5e0);
     ]], {
         -- <func3-5.2>
         -9223372036854775808LL
@@ -48,7 +48,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.3",
     [[
-        SELECT likelihood(1.4125e1, 5e-1);
+        SELECT likelihood(14.125e0, 0.5e0);
     ]], {
         -- <func3-5.3>
         14.125
@@ -58,7 +58,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.4",
     [[
-        SELECT likelihood(NULL, 5e-1);
+        SELECT likelihood(NULL, 0.5e0);
     ]], {
         -- <func3-5.4>
         ""
@@ -68,7 +68,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.5",
     [[
-        SELECT likelihood('test-string', 5e-1);
+        SELECT likelihood('test-string', 0.5e0);
     ]], {
         -- <func3-5.5>
         "test-string"
@@ -78,7 +78,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.6",
     [[
-        SELECT quote(likelihood(x'010203000405', 5e-1));
+        SELECT quote(likelihood(x'010203000405', 0.5e0));
     ]], {
         -- <func3-5.6>
         "X'010203000405'"
@@ -111,7 +111,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "func3-5.9",
     [[
-        SELECT likelihood(123, -1e-6);
+        SELECT likelihood(123, -0.000001e0);
     ]], {
         -- <func3-5.9>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -121,7 +121,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "func3-5.10",
     [[
-        SELECT likelihood(123, 0.5 + 3e-1);
+        SELECT likelihood(123, 0.5e0 + 0.3e0);
     ]], {
         -- <func3-5.10>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -135,7 +135,7 @@ test:do_catchsql_test(
 test:do_test(
     "func3-5.20",
     function()
-        return test:execsql "EXPLAIN SELECT likelihood(LEAST(1.0+'2.0',4*11), 5e-1)"
+        return test:execsql "EXPLAIN SELECT likelihood(LEAST(1.0+'2.0',4*11), 0.5e0)"
     end, test:execsql("EXPLAIN SELECT LEAST(1.0+'2.0',4*11)"))
 
 -- EVIDENCE-OF: R-11152-23456 The unlikely(X) function returns the
@@ -164,7 +164,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.32",
     [[
-        SELECT unlikely(1.4125e1);
+        SELECT unlikely(14.125e0);
     ]], {
         -- <func3-5.32>
         14.125
@@ -237,7 +237,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.52",
     [[
-        SELECT likely(1.4125e1);
+        SELECT likely(14.125e0);
     ]], {
         -- <func3-5.52>
         14.125
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 771891380..159bccd8f 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -217,7 +217,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.1",
     [[
-        SELECT 1e-1
+        SELECT 0.1e0
     ]], {
         -- <misc5-5.1>
         0.1
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index 131f75eab..8164b8219 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1157,7 +1157,7 @@ test:do_test(
     function()
         set_full_column_names(true)
         return test:execsql2 [[
-            SELECT 1.2345e2;
+            SELECT 123.45e0;
         ]]
     end, {
         -- <select1-6.9.5>
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index 6c0b8e1ed..f5bd75cb8 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -443,7 +443,7 @@ for ii = 3, 6, 1 do
             SELECT x, y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 1e-1, f*10 + 1e-1 FROM t1 JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) ORDER BY 1;
@@ -457,7 +457,7 @@ for ii = 3, 6, 1 do
             SELECT x, y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 1e-1, f*10 + 1e-1 FROM t1 LEFT JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 LEFT JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) ORDER BY 1;
@@ -471,7 +471,7 @@ for ii = 3, 6, 1 do
             SELECT x+y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 1e-1, f*10 + 1e-1 FROM t1 LEFT JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 LEFT JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) WHERE y+x IS NOT NULL ORDER BY 1;
diff --git a/test/sql-tap/uuid.test.lua b/test/sql-tap/uuid.test.lua
index d5bef611f..d6c53d123 100755
--- a/test/sql-tap/uuid.test.lua
+++ b/test/sql-tap/uuid.test.lua
@@ -339,7 +339,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "uuid-6.1.15",
     [[
-        SELECT LIKELIHOOD(u, 5e-1) from t2;
+        SELECT LIKELIHOOD(u, 0.5e0) from t2;
     ]], {
         uuid1, uuid3, uuid2
     })
diff --git a/test/sql-tap/whereG.test.lua b/test/sql-tap/whereG.test.lua
index 1996b007f..8d91b7978 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -103,7 +103,7 @@ test:do_eqp_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', 5e-1)
+         WHERE likelihood(cname LIKE '%bach%', 0.5e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -117,7 +117,7 @@ test:do_execsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%' COLLATE "unicode_ci", 5e-1)
+         WHERE likelihood(cname LIKE '%bach%' COLLATE "unicode_ci", 0.5e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -187,7 +187,7 @@ test:do_catchsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', -1e-1)
+         WHERE likelihood(cname LIKE '%bach%', -0.1e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -370,7 +370,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "7.2",
     [[
-        SELECT likelihood(a,5e-1), x FROM t1, t2 ORDER BY 1, 2;
+        SELECT likelihood(a, 0.5e0), x FROM t1, t2 ORDER BY 1, 2;
     ]], {
         -- <7.2>
         1, 3, 1, 4, 9, 3, 9, 4
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 44d5a954e..2aa9f0aca 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -534,8 +534,8 @@ test:do_catchsql_test(7.6, [[
 --
 test:do_execsql_test("8.1-mandelbrot", [[
   WITH RECURSIVE
-    xaxis(x) AS (VALUES(-2e0) UNION ALL SELECT x+5e-2 FROM xaxis WHERE x<1.2e0),
-    yaxis(y) AS (VALUES(-1e0) UNION ALL SELECT y+1e-1 FROM yaxis WHERE y<1.0e0),
+    xaxis(x) AS (VALUES(-2e0) UNION ALL SELECT x + 0.05e0 FROM xaxis WHERE x < 1.2e0),
+    yaxis(y) AS (VALUES(-1e0) UNION ALL SELECT y + 0.1e0 FROM yaxis WHERE y < 1.0e0),
     m(iter, cx, cy, x, y) AS (
       SELECT 0, x, y, 0e0, 0e0 FROM xaxis, yaxis
       UNION ALL
diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
index c890de7a3..efc0a7493 100644
--- a/test/sql/func-recreate.result
+++ b/test/sql/func-recreate.result
@@ -25,7 +25,7 @@ test_run:cmd("setopt delimiter ''");
 ch = fiber.channel(1)
 ---
 ...
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(2e-1)')) end)
+_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2e0)')) end)
 ---
 ...
 fiber.sleep(0.1)
diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
index a281637c3..d0132f120 100644
--- a/test/sql/func-recreate.test.lua
+++ b/test/sql/func-recreate.test.lua
@@ -13,7 +13,7 @@ test_run:cmd("setopt delimiter ''");
 
 ch = fiber.channel(1)
 
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(2e-1)')) end)
+_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2e0)')) end)
 fiber.sleep(0.1)
 
 box.func.WAITFOR:drop()


New patch:

commit 2731dc7bf43486d2f0f251dc05b1f3f11855e9df
Author: Mergen Imeev <imeevma@gmail.com>
Date:   Sat Sep 25 15:53:12 2021 +0300

    sql: introduce literals for DECIMAL
    
    Part of #6356
    
    @TarantoolBot document
    Title: Literals for INTEGER, DECIMAL and DOUBLE
    
    The rules for parsing numeric values have changed:
    1) a value consisting of digits without decimal point and exponent will
    be parsed as INTEGER;
    2) a value consisting of digits and a decimal point will be parsed as
    DECIMAL;
    3) a value consisting of digits, containing an exponent and possibly
    containing a decimal point, will be parsed as DOUBLE.

diff --git a/changelogs/unreleased/gh-6356-literals-for-decimal.md b/changelogs/unreleased/gh-6356-literals-for-decimal.md
new file mode 100644
index 000000000..24b8d7e40
--- /dev/null
+++ b/changelogs/unreleased/gh-6356-literals-for-decimal.md
@@ -0,0 +1,4 @@
+## feature/sql
+
+* A value consisting of digits and a decimal point is now parsed as
+  DECIMAL (gh-6456).
diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index ee21c1ede..9e635a0f8 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -3286,6 +3286,30 @@ codeReal(Vdbe * v, const char *z, int negateFlag, int iMem)
 	}
 }
 
+static void
+expr_code_dec(struct Parse *parser, struct Expr *expr, bool is_neg, int reg)
+{
+	const char *str = expr->u.zToken;
+	assert(str != NULL);
+	decimal_t *value = sqlDbMallocRawNN(sql_get(), sizeof(*value));
+	if (value == NULL)
+		goto error;
+	if (is_neg) {
+		decimal_t dec;
+		if (decimal_from_string(&dec, str) == NULL)
+			goto error;
+		decimal_minus(value, &dec);
+	} else if (decimal_from_string(value, str) == NULL) {
+		goto error;
+	}
+	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, (char *)value,
+		      P4_DEC);
+	return;
+error:
+	sqlDbFree(sql_get(), value);
+	parser->is_aborted = true;
+}
+
 /**
  * Generate an instruction that will put the integer describe by
  * text z[0..n-1] into register iMem.
@@ -3725,6 +3749,10 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 			sqlVdbeAddOp2(v, OP_Bool, op == TK_TRUE, target);
 			return target;
 		}
+	case TK_DECIMAL:{
+			expr_code_dec(pParse, pExpr, false, target);
+			return target;
+		}
 	case TK_FLOAT:{
 			assert(!ExprHasProperty(pExpr, EP_IntValue));
 			codeReal(v, pExpr->u.zToken, 0, target);
@@ -3884,6 +3912,9 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 				assert(!ExprHasProperty(pExpr, EP_IntValue));
 				codeReal(v, pLeft->u.zToken, 1, target);
 				return target;
+			} else if (pLeft->op == TK_DECIMAL) {
+				expr_code_dec(pParse, pLeft, true, target);
+				return target;
 			} else {
 				tempX.op = TK_INTEGER;
 				tempX.flags = EP_IntValue | EP_TokenOnly;
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 337df4916..ae480a5d1 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -994,6 +994,9 @@ idlist(A) ::= nm(Y). {
       case TK_FLOAT:
         p->type = FIELD_TYPE_DOUBLE;
         break;
+      case TK_DECIMAL:
+        p->type = FIELD_TYPE_DECIMAL;
+        break;
       case TK_TRUE:
       case TK_FALSE:
       case TK_UNKNOWN:
@@ -1071,6 +1074,7 @@ term(A) ::= STRING(X).     {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= FALSE(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= TRUE(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= UNKNOWN(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
+term(A) ::= DECIMAL(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 
 term(A) ::= INTEGER(X). {
   A.pExpr = sql_expr_new_dequoted(pParse->db, TK_INTEGER, &X);
diff --git a/src/box/sql/tokenize.c b/src/box/sql/tokenize.c
index 0899cf23e..b3cf8f6e6 100644
--- a/src/box/sql/tokenize.c
+++ b/src/box/sql/tokenize.c
@@ -343,7 +343,7 @@ sql_token(const char *z, int *type, bool *is_reserved)
 		if (z[i] == '.') {
 			while (sqlIsdigit(z[++i])) {
 			}
-			*type = TK_FLOAT;
+			*type = TK_DECIMAL;
 		}
 		if ((z[i] == 'e' || z[i] == 'E') &&
 		    (sqlIsdigit(z[i + 1])
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 44533fb3e..c70c1fb30 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -804,6 +804,18 @@ case OP_Real: {            /* same as TK_FLOAT, out2 */
 	break;
 }
 
+/**
+ * Opcode: Decimal * P2 * P4 *
+ * Synopsis: r[P2]=P4
+ *
+ * P4 is a pointer to a DECIMAL value. Write that value into register P2.
+ */
+case OP_Decimal: {            /* same as TK_DECIMAL, out2 */
+	pOut = vdbe_prepare_null_out(p, pOp->p2);
+	mem_set_dec(pOut, pOp->p4.dec);
+	break;
+}
+
 /* Opcode: String8 * P2 * P4 *
  * Synopsis: r[P2]='P4'
  *
diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h
index e40a1a0b3..121b86029 100644
--- a/src/box/sql/vdbe.h
+++ b/src/box/sql/vdbe.h
@@ -97,6 +97,8 @@ struct VdbeOp {
 		 * Information about ephemeral space field types and key parts.
 		 */
 		struct sql_space_info *space_info;
+		/** P4 contains address of decimal. */
+		decimal_t *dec;
 	} p4;
 #ifdef SQL_ENABLE_EXPLAIN_COMMENTS
 	char *zComment;		/* Comment to improve readability */
@@ -132,6 +134,8 @@ struct SubProgram {
 #define P4_COLLSEQ  (-3)	/* P4 is a pointer to a CollSeq structure */
 /** P4 is a pointer to a func structure. */
 #define P4_FUNC     (-4)
+/** P4 is a pointer to a decimal. */
+#define P4_DEC      (-5)
 #define P4_MEM      (-7)	/* P4 is a pointer to a Mem*    structure */
 #define P4_TRANSIENT  0		/* P4 is a pointer to a transient string */
 #define P4_REAL     (-9)	/* P4 is a 64-bit floating point value */
diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
index 115940227..22c6bd656 100644
--- a/src/box/sql/vdbeapi.c
+++ b/src/box/sql/vdbeapi.c
@@ -563,6 +563,9 @@ sql_stmt_est_size(const struct sql_stmt *stmt)
 		case P4_REAL:
 			size += sizeof(*v->aOp[i].p4.pReal);
 			break;
+		case P4_DEC:
+			size += sizeof(*v->aOp[i].p4.dec);
+			break;
 		default:
 			size += sizeof(v->aOp[i].p4.p);
 			break;
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index 8148ed8b0..4ce08359c 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -605,6 +605,7 @@ freeP4(sql * db, int p4type, void *p4)
 			freeP4FuncCtx(db, (sql_context *) p4);
 			break;
 		}
+	case P4_DEC:
 	case P4_REAL:
 	case P4_INT64:
 	case P4_UINT64:
@@ -1095,6 +1096,10 @@ displayP4(Op * pOp, char *zTemp, int nTemp)
 			sqlXPrintf(&x, "%.16g", *pOp->p4.pReal);
 			break;
 		}
+	case P4_DEC:{
+			sqlXPrintf(&x, "%s", decimal_str(pOp->p4.dec));
+			break;
+		}
 	case P4_MEM:{
 			const char *value = mem_str(pOp->p4.pMem);
 			sqlStrAccumAppend(&x, value, strlen(value));
diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
index 68d2ae585..d5c9cbbc6 100755
--- a/test/sql-tap/cast.test.lua
+++ b/test/sql-tap/cast.test.lua
@@ -307,7 +307,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.31",
     [[
-        SELECT 123.456
+        SELECT 123.456e0
     ]], {
         -- <cast-1.31>
         123.456
@@ -317,7 +317,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.32",
     [[
-        SELECT typeof(123.456)
+        SELECT typeof(123.456e0)
     ]], {
         -- <cast-1.32>
         "double"
@@ -337,7 +337,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.34",
     [[
-        SELECT typeof(CAST(123.456 AS text))
+        SELECT typeof(CAST(123.456e0 AS text))
     ]], {
         -- <cast-1.34>
         "string"
@@ -347,7 +347,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.35",
     [[
-        SELECT CAST(123.456 AS NUMBER)
+        SELECT CAST(123.456e0 AS NUMBER)
     ]], {
         -- <cast-1.35>
         123.456
@@ -357,7 +357,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.36",
     [[
-        SELECT typeof(CAST(123.456 AS DOUBLE))
+        SELECT typeof(CAST(123.456e0 AS DOUBLE))
     ]], {
         -- <cast-1.36>
         "double"
@@ -367,7 +367,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.37",
     [[
-        SELECT CAST(123.456 AS SCALAR)
+        SELECT CAST(123.456e0 AS SCALAR)
     ]], {
         -- <cast-1.37>
         123.456
@@ -377,7 +377,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.38",
     [[
-        SELECT typeof(CAST(123.456 AS SCALAR))
+        SELECT typeof(CAST(123.456e0 AS SCALAR))
     ]], {
         -- <cast-1.38>
         "scalar"
@@ -387,7 +387,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.39",
     [[
-        SELECT CAST(123.456 AS integer)
+        SELECT CAST(123.456e0 AS integer)
     ]], {
         -- <cast-1.39>
         123
@@ -397,7 +397,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.38",
     [[
-        SELECT typeof(CAST(123.456 AS integer))
+        SELECT typeof(CAST(123.456e0 AS integer))
     ]], {
         -- <cast-1.38>
         "integer"
@@ -962,7 +962,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-6.2.3",
     [[
-        SELECT CAST(1.5 AS BOOLEAN);
+        SELECT CAST(1.5e0 AS BOOLEAN);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to boolean"
     })
@@ -1139,7 +1139,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-10.4",
     [[
-        SELECT '1' < 2.5;
+        SELECT '1' < 2.5e0;
     ]], {
         1, "Type mismatch: can not convert double(2.5) to string"
     })
diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua
index f8dcb7f7b..6c0707f6b 100755
--- a/test/sql-tap/check.test.lua
+++ b/test/sql-tap/check.test.lua
@@ -207,7 +207,7 @@ test:do_execsql_test(
         CREATE TABLE t2(
           id  INT primary key,
           x SCALAR CONSTRAINT one CHECK( typeof(coalesce(x,0))=='integer'),
-          y DOUBLE CONSTRAINT two CHECK( typeof(coalesce(y,0.1))=='double' ),
+          y DOUBLE CONSTRAINT two CHECK( typeof(coalesce(y,0.1e0))=='double' ),
           z SCALAR CONSTRAINT three CHECK( typeof(coalesce(z,''))=='string' )
         );
     ]], {
diff --git a/test/sql-tap/decimal.test.lua b/test/sql-tap/decimal.test.lua
index d422533d6..a6d66b75b 100755
--- a/test/sql-tap/decimal.test.lua
+++ b/test/sql-tap/decimal.test.lua
@@ -3,7 +3,7 @@ local build_path = os.getenv("BUILDDIR")
 package.cpath = build_path..'/test/sql-tap/?.so;'..build_path..'/test/sql-tap/?.dylib;'..package.cpath
 
 local test = require("sqltester")
-test:plan(104)
+test:plan(109)
 
 local dec = require("decimal")
 local dec1 = dec.new("111")
@@ -684,7 +684,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "dec-11.2.4",
     [[
-        INSERT INTO tsu VALUES ('4_double', 1.5);
+        INSERT INTO tsu VALUES ('4_double', 1.5e0);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -819,7 +819,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "dec-14.1.3",
     [[
-        SELECT u - 0.5 FROM t2;
+        SELECT u - 0.5e0 FROM t2;
     ]], {
         110.5, 3332.5, 55554.5
     })
@@ -835,7 +835,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "dec-14.1.5",
     [[
-        SELECT u / 1.0 FROM t2;
+        SELECT u / 1e0 FROM t2;
     ]], {
         111, 3333, 55555
     })
@@ -972,4 +972,50 @@ test:execsql([[
     DROP TABLE t1;
 ]])
 
+--
+-- gh-6356: Make sure that numeric literals with a decimal point and no exponent
+-- are treated as DECIMAL.
+--
+test:do_execsql_test(
+    "dec-17.1",
+    [[
+        SELECT 1.0, typeof(1.0);
+    ]], {
+        dec.new(1), 'decimal'
+    })
+
+test:do_test(
+    "dec-17.2",
+    function()
+        return box.execute([[SELECT 1.0;]]).metadata
+    end, {
+        {name = "COLUMN_1", type = "decimal"}
+    })
+
+test:do_execsql_test(
+    "dec-17.3",
+    [[
+        SELECT typeof(1), typeof(1e0), typeof(1.0);
+    ]], {
+        "integer", "double", "decimal"
+    })
+
+test:do_execsql_test(
+    "dec-17.4",
+    [[
+        SELECT 999999999999999999999999999999999999.9;
+    ]], {
+        dec.new('999999999999999999999999999999999999.9')
+    })
+
+-- Make sure that large number without a decimal point is not parsed as DECIMAL.
+test:do_catchsql_test(
+    "dec-17.5",
+    [[
+        SELECT 999999999999999999999999999999999999;
+    ]], {
+        1, [[Integer literal 999999999999999999999999999999999999 exceeds ]]..
+           "the supported range [-9223372036854775808, 18446744073709551615]"
+    })
+
 test:finish_test()
diff --git a/test/sql-tap/default.test.lua b/test/sql-tap/default.test.lua
index 9c15220eb..da911c61b 100755
--- a/test/sql-tap/default.test.lua
+++ b/test/sql-tap/default.test.lua
@@ -105,11 +105,11 @@ test:do_execsql_test(
 	b INT DEFAULT 12345 UNIQUE NOT NULL CHECK( b>=0 AND b<99999 ),
 	c VARCHAR(123) DEFAULT 'hello' NOT NULL,
 	d NUMBER,
-	e NUMBER DEFAULT 4.36,
+	e NUMBER DEFAULT 4.36e0,
 	f VARCHAR(15), --COLLATE RTRIM,
 	g INTEGER DEFAULT( 3600*12 )
 	);
-	INSERT INTO t3 VALUES(null, 5, 'row1', 5.25, 8.67, '321', 432);
+	INSERT INTO t3 VALUES(null, 5, 'row1', 5.25e0, 8.67e0, '321', 432);
 	SELECT a, typeof(a), b, typeof(b), c, typeof(c),
 	d, typeof(d), e, typeof(e), f, typeof(f),
 	g, typeof(g) FROM t3;
diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
index 9f10994ae..f78e2de7d 100755
--- a/test/sql-tap/e_select1.test.lua
+++ b/test/sql-tap/e_select1.test.lua
@@ -327,7 +327,7 @@ test:do_execsql_test(
     "e_select-1.4.0",
     [[
         CREATE TABLE x1(id  INT primary key, a TEXT , b TEXT );
-        CREATE TABLE x2(id  INT primary key, c NUMBER , d NUMBER , e NUMBER );
+        CREATE TABLE x2(id  INT primary key, c DOUBLE, d DOUBLE, e DOUBLE);
         CREATE TABLE x3(id  INT primary key, f TEXT , g TEXT , h TEXT , i TEXT );
 
         -- x1: 3 rows, 2 columns
@@ -1482,8 +1482,8 @@ test:drop_all_tables()
 test:do_execsql_test(
     "e_select-7.4.0",
     [[
-        CREATE TABLE q1(id  INT primary key, a TEXT, b NUMBER, c NUMBER);
-        CREATE TABLE q2(id  INT primary key, d TEXT, e NUMBER);
+        CREATE TABLE q1(id  INT primary key, a TEXT, b DOUBLE, c DOUBLE);
+        CREATE TABLE q2(id  INT primary key, d TEXT, e DOUBLE);
         CREATE TABLE q3(id  INT primary key, f TEXT, g INT);
 
         INSERT INTO q1 VALUES(1, '16', -87.66, NULL);
@@ -1632,7 +1632,7 @@ test:drop_all_tables()
 test:do_execsql_test(
     "e_select-7.10.0",
     [[
-        CREATE TABLE w1(a TEXT PRIMARY KEY, b NUMBER);
+        CREATE TABLE w1(a TEXT PRIMARY KEY, b DOUBLE);
         CREATE TABLE w2(a  INT PRIMARY KEY, b TEXT);
 
         INSERT INTO w1 VALUES('1', 4.1);
@@ -1908,7 +1908,7 @@ test:do_select_tests(
 test:do_execsql_test(
     "e_select-8.8.0",
     [[
-        CREATE TABLE d3(id  INT primary key, a NUMBER);
+        CREATE TABLE d3(id  INT primary key, a DOUBLE);
         INSERT INTO d3 VALUES(1, 0);
         INSERT INTO d3 VALUES(2, 14.1);
         INSERT INTO d3 VALUES(3, 13);
@@ -2193,7 +2193,7 @@ for _, val in ipairs({
     {"1", "SELECT b FROM f1 ORDER BY a LIMIT 'hello' "},
     {"2", "SELECT b FROM f1 ORDER BY a LIMIT NULL "},
     {"3", "SELECT b FROM f1 ORDER BY a LIMIT X'ABCD' "},
-    {"4", "SELECT b FROM f1 ORDER BY a LIMIT 5.1 "},
+    {"4", "SELECT b FROM f1 ORDER BY a LIMIT 5.1e0 "},
     {"5", "SELECT b FROM f1 ORDER BY a LIMIT (SELECT group_concat(b) FROM f1)"}}) do
     local tn = val[1]
     local select = val[2]
@@ -2248,7 +2248,7 @@ for _, val in ipairs({
     {1, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 'hello'"},
     {2, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET NULL"},
     {3, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET X'ABCD'"},
-    {4, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 5.1"},
+    {4, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 51e-1"},
     {5, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET (SELECT group_concat(b) FROM f1)"}}) do
     local tn = val[1]
     local select = val[2]
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index 416f27d69..29e1c3de2 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -678,7 +678,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func-4.35",
     [[
-        SELECT round(1234567890123.445,2);
+        SELECT round(1234567890123.445e0,2);
     ]], {
         -- <func-4.35>
         1234567890123.45
@@ -708,7 +708,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func-4.38",
     [[
-        SELECT round(9999999999999.556,2);
+        SELECT round(9999999999999.556e0, 2);
     ]], {
         -- <func-4.38>
         9999999999999.56
@@ -1497,7 +1497,7 @@ test:do_execsql_test(
     "func-18.12",
     [[
         INSERT INTO t6 VALUES(3, 1<<62);
-        SELECT sum(x) - ((1<<62)*2.0+1) from t6;
+        SELECT sum(x) - ((1 << 62) * 2e0 + 1) from t6;
     ]], {
         -- <func-18.12>
         0
@@ -2817,7 +2817,7 @@ test:do_execsql_test("func-77.1", "SELECT TOSTRING('1');", {'1'})
 test:do_execsql_test("func-77.2", "SELECT TOSTRING('a');", {'a'})
 test:do_catchsql_test("func-77.3", "SELECT TOSTRING(1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got unsigned"})
 test:do_catchsql_test("func-77.4", "SELECT TOSTRING(-1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got integer"})
-test:do_catchsql_test("func-77.5", "SELECT TOSTRING(-1.1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got double"})
+test:do_catchsql_test("func-77.5", "SELECT TOSTRING(-1.1e0);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got double"})
 test:do_catchsql_test("func-77.6", "SELECT TOSTRING(TRUE);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got boolean"})
 test:do_execsql_test("func-77.7", "SELECT TOSTRING(NULL);", {""})
 test:do_execsql_test("func-77.8", "SELECT TOSTRING(LUA('return nil'));", {""})
@@ -2837,7 +2837,7 @@ test:do_catchsql_test("func-78.1", "SELECT TOUNSIGNED('1');", {1, "Function 'TOU
 test:do_catchsql_test("func-78.2", "SELECT TOUNSIGNED('a');", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got string"})
 test:do_execsql_test("func-78.3", "SELECT TOUNSIGNED(1);", {1})
 test:do_catchsql_test("func-78.4", "SELECT TOUNSIGNED(-1);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got integer"})
-test:do_catchsql_test("func-78.5", "SELECT TOUNSIGNED(-1.1);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got double"})
+test:do_catchsql_test("func-78.5", "SELECT TOUNSIGNED(-1.1e0);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got double"})
 test:do_catchsql_test("func-78.6", "SELECT TOUNSIGNED(TRUE);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got boolean"})
 test:do_execsql_test("func-78.7", "SELECT TOUNSIGNED(NULL);", {""})
 test:do_execsql_test("func-78.8", "SELECT TOUNSIGNED(LUA('return nil'));", {""})
@@ -2857,7 +2857,7 @@ test:do_catchsql_test("func-79.1", "SELECT TOINTEGER('1');", {1, "Function 'TOIN
 test:do_catchsql_test("func-79.2", "SELECT TOINTEGER('a');", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got string"})
 test:do_execsql_test("func-79.3", "SELECT TOINTEGER(1);", {1})
 test:do_execsql_test("func-79.4", "SELECT TOINTEGER(-1);", {-1})
-test:do_catchsql_test("func-79.5", "SELECT TOINTEGER(-1.1);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got double"})
+test:do_catchsql_test("func-79.5", "SELECT TOINTEGER(-1.1e0);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got double"})
 test:do_catchsql_test("func-79.6", "SELECT TOINTEGER(TRUE);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got boolean"})
 test:do_execsql_test("func-79.7", "SELECT TOINTEGER(NULL);", {""})
 test:do_execsql_test("func-79.8", "SELECT TOINTEGER(LUA('return nil'));", {""})
@@ -2877,7 +2877,7 @@ test:do_catchsql_test("func-80.1", "SELECT TONUMBER('1');", {1, "Function 'TONUM
 test:do_catchsql_test("func-80.2", "SELECT TONUMBER('a');", {1, "Function 'TONUMBER' returned value of invalid type: expected number got string"})
 test:do_execsql_test("func-80.3", "SELECT TONUMBER(1);", {1})
 test:do_execsql_test("func-80.4", "SELECT TONUMBER(-1);", {-1})
-test:do_execsql_test("func-80.5", "SELECT TONUMBER(-1.1);", {-1.1})
+test:do_execsql_test("func-80.5", "SELECT TONUMBER(-1.1e0);", {-1.1})
 test:do_catchsql_test("func-80.6", "SELECT TONUMBER(TRUE);", {1, "Function 'TONUMBER' returned value of invalid type: expected number got boolean"})
 test:do_execsql_test("func-80.7", "SELECT TONUMBER(NULL);", {""})
 test:do_execsql_test("func-80.8", "SELECT TONUMBER(LUA('return nil'));", {""})
@@ -2897,7 +2897,7 @@ test:do_catchsql_test("func-81.1", "SELECT TOBOOLEAN('1');", {1, "Function 'TOBO
 test:do_catchsql_test("func-81.2", "SELECT TOBOOLEAN('a');", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got string"})
 test:do_catchsql_test("func-81.3", "SELECT TOBOOLEAN(1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got unsigned"})
 test:do_catchsql_test("func-81.4", "SELECT TOBOOLEAN(-1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got integer"})
-test:do_catchsql_test("func-81.5", "SELECT TOBOOLEAN(-1.1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got double"})
+test:do_catchsql_test("func-81.5", "SELECT TOBOOLEAN(-1.1e0);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got double"})
 test:do_execsql_test("func-81.6", "SELECT TOBOOLEAN(TRUE);", {true})
 test:do_execsql_test("func-81.7", "SELECT TOBOOLEAN(NULL);", {""})
 test:do_execsql_test("func-81.8", "SELECT TOBOOLEAN(LUA('return nil'));", {""})
@@ -2917,7 +2917,7 @@ test:do_execsql_test("func-82.1", "SELECT TOSCALAR('1');", {'1'})
 test:do_execsql_test("func-82.2", "SELECT TOSCALAR('a');", {'a'})
 test:do_execsql_test("func-82.3", "SELECT TOSCALAR(1);", {1})
 test:do_execsql_test("func-82.4", "SELECT TOSCALAR(-1);", {-1})
-test:do_execsql_test("func-82.5", "SELECT TOSCALAR(-1.1);", {-1.1})
+test:do_execsql_test("func-82.5", "SELECT TOSCALAR(-1.1e0);", {-1.1})
 test:do_execsql_test("func-82.6", "SELECT TOSCALAR(TRUE);", {true})
 test:do_execsql_test("func-82.7", "SELECT TOSCALAR(NULL);", {""})
 test:do_execsql_test("func-82.8", "SELECT TOSCALAR(LUA('return nil'));", {""})
diff --git a/test/sql-tap/func3.test.lua b/test/sql-tap/func3.test.lua
index 7f1d8d33c..8d6268bb7 100755
--- a/test/sql-tap/func3.test.lua
+++ b/test/sql-tap/func3.test.lua
@@ -28,7 +28,7 @@ test:plan(35)
 test:do_execsql_test(
     "func3-5.1",
     [[
-        SELECT likelihood(9223372036854775807, 0.5);
+        SELECT likelihood(9223372036854775807, 0.5e0);
     ]], {
         -- <func3-5.1>
         9223372036854775807LL
@@ -38,7 +38,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.2",
     [[
-        SELECT likelihood(-9223372036854775808, 0.5);
+        SELECT likelihood(-9223372036854775808, 0.5e0);
     ]], {
         -- <func3-5.2>
         -9223372036854775808LL
@@ -48,7 +48,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.3",
     [[
-        SELECT likelihood(14.125, 0.5);
+        SELECT likelihood(14.125e0, 0.5e0);
     ]], {
         -- <func3-5.3>
         14.125
@@ -58,7 +58,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.4",
     [[
-        SELECT likelihood(NULL, 0.5);
+        SELECT likelihood(NULL, 0.5e0);
     ]], {
         -- <func3-5.4>
         ""
@@ -68,7 +68,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.5",
     [[
-        SELECT likelihood('test-string', 0.5);
+        SELECT likelihood('test-string', 0.5e0);
     ]], {
         -- <func3-5.5>
         "test-string"
@@ -78,7 +78,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.6",
     [[
-        SELECT quote(likelihood(x'010203000405', 0.5));
+        SELECT quote(likelihood(x'010203000405', 0.5e0));
     ]], {
         -- <func3-5.6>
         "X'010203000405'"
@@ -91,7 +91,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.7",
     [[
-        SELECT likelihood(123, 1.0), likelihood(456, 0.0);
+        SELECT likelihood(123, 1e0), likelihood(456, 0e0);
     ]], {
         -- <func3-5.7>
         123, 456
@@ -101,7 +101,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "func3-5.8",
     [[
-        SELECT likelihood(123, 1.000001);
+        SELECT likelihood(123, 1.000001e0);
     ]], {
         -- <func3-5.8>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -111,7 +111,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "func3-5.9",
     [[
-        SELECT likelihood(123, -0.000001);
+        SELECT likelihood(123, -0.000001e0);
     ]], {
         -- <func3-5.9>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -121,7 +121,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "func3-5.10",
     [[
-        SELECT likelihood(123, 0.5+0.3);
+        SELECT likelihood(123, 0.5e0 + 0.3e0);
     ]], {
         -- <func3-5.10>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -135,7 +135,7 @@ test:do_catchsql_test(
 test:do_test(
     "func3-5.20",
     function()
-        return test:execsql "EXPLAIN SELECT likelihood(LEAST(1.0+'2.0',4*11), 0.5)"
+        return test:execsql "EXPLAIN SELECT likelihood(LEAST(1.0+'2.0',4*11), 0.5e0)"
     end, test:execsql("EXPLAIN SELECT LEAST(1.0+'2.0',4*11)"))
 
 -- EVIDENCE-OF: R-11152-23456 The unlikely(X) function returns the
@@ -164,7 +164,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.32",
     [[
-        SELECT unlikely(14.125);
+        SELECT unlikely(14.125e0);
     ]], {
         -- <func3-5.32>
         14.125
@@ -237,7 +237,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.52",
     [[
-        SELECT likely(14.125);
+        SELECT likely(14.125e0);
     ]], {
         -- <func3-5.52>
         14.125
diff --git a/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua b/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
index 37bf62487..2a6a60a81 100755
--- a/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
+++ b/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
@@ -25,7 +25,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-1.3",
     [[
-        SELECT 9 >> 2.0;
+        SELECT 9 >> 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -82,7 +82,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-2.3",
     [[
-        SELECT 9 << 2.0;
+        SELECT 9 << 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -139,7 +139,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-3.3",
     [[
-        SELECT 9 & 2.0;
+        SELECT 9 & 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -196,7 +196,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-4.3",
     [[
-        SELECT 9 | 2.0;
+        SELECT 9 | 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
diff --git a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
index 390a2d9b2..bf636a261 100755
--- a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
+++ b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
@@ -25,7 +25,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-1.3",
     [[
-        SELECT 9 + 2.0;
+        SELECT 9 + 2e0;
     ]], {
         11
     })
@@ -82,7 +82,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-2.3",
     [[
-        SELECT 9 - 2.0;
+        SELECT 9 - 2e0;
     ]], {
         7
     })
@@ -139,7 +139,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-3.3",
     [[
-        SELECT 9 * 2.0;
+        SELECT 9 * 2e0;
     ]], {
         18
     })
@@ -196,7 +196,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-4.3",
     [[
-        SELECT 9 / 2.0;
+        SELECT 9 / 2e0;
     ]], {
         4.5
     })
@@ -253,7 +253,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "gh-5756-5.3",
     [[
-        SELECT 9 % 2.0;
+        SELECT 9 % 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to integer"
     })
diff --git a/test/sql-tap/gh-6239-quote-with-double-arg.test.lua b/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
index dab12253e..2642d799b 100755
--- a/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
+++ b/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
@@ -6,7 +6,7 @@ test:plan(1)
 test:do_execsql_test(
     "gh-6239",
     [[
-        SELECT QUOTE(1.5), TYPEOF(QUOTE(1.5));
+        SELECT QUOTE(1.5e0), TYPEOF(QUOTE(1.5e0));
     ]], {
         1.5, "double"
     })
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index 3230556d1..3879481df 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -598,7 +598,7 @@ end
 test:do_execsql_test(
     "index-12.1",
     [[
-        CREATE TABLE t4(id  INT primary key, a NUMBER,b INT );
+        CREATE TABLE t4(id INT primary key, a DOUBLE, b INT );
         INSERT INTO t4 VALUES(1, 0.0, 1);
         INSERT INTO t4 VALUES(2, 0.00, 2);
         INSERT INTO t4 VALUES(4, -1.0, 4);
diff --git a/test/sql-tap/insert3.test.lua b/test/sql-tap/insert3.test.lua
index 062fb1e33..3547122f0 100755
--- a/test/sql-tap/insert3.test.lua
+++ b/test/sql-tap/insert3.test.lua
@@ -236,7 +236,8 @@ test:do_execsql_test(
 test:do_execsql_test(
     "insert3-3.7",
     [[
-            CREATE TABLE t6(id INTEGER PRIMARY KEY AUTOINCREMENT, x INT ,y NUMBER DEFAULT 4.3, z TEXT DEFAULT 'hi');
+            CREATE TABLE t6(id INTEGER PRIMARY KEY AUTOINCREMENT, x INT,
+                            y DOUBLE DEFAULT 4.3, z TEXT DEFAULT 'hi');
             INSERT INTO t6 DEFAULT VALUES;
             SELECT * FROM t6;
     ]], {
diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
index 993417414..d2dd6b679 100755
--- a/test/sql-tap/lua_sql.test.lua
+++ b/test/sql-tap/lua_sql.test.lua
@@ -39,8 +39,8 @@ test:do_catchsql_test(
 for _, val in ipairs({
         {1, "'val'", "val"},
         {2, 1, 1},
-        {3, "1.0", 1},
-        {4, 1.5, 1.5},
+        {3, "1.0e0", 1},
+        {4, 1.5, require('decimal').new(1.5)},
     }) do
     local tn = val[1]
     local param = val[2]
diff --git a/test/sql-tap/metatypes.test.lua b/test/sql-tap/metatypes.test.lua
index 3e4091675..dfa5bbab4 100755
--- a/test/sql-tap/metatypes.test.lua
+++ b/test/sql-tap/metatypes.test.lua
@@ -14,7 +14,7 @@ test:do_execsql_test(
     "metatypes-1.1",
     [[
         INSERT INTO t VALUES(1, 1, 1);
-        INSERT INTO t VALUES(2, 2.0, 2.0);
+        INSERT INTO t VALUES(2, 2e0, 2e0);
         INSERT INTO t(i, s) VALUES(3, '3');
         INSERT INTO t(i, s) VALUES(4, true);
         INSERT INTO t(i, s) VALUES(5, x'35');
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 38eddfc64..159bccd8f 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -217,7 +217,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.1",
     [[
-        SELECT .1
+        SELECT 0.1e0
     ]], {
         -- <misc5-5.1>
         0.1
@@ -227,7 +227,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.2",
     [[
-        SELECT 2.
+        SELECT 2e0
     ]], {
         -- <misc5-5.2>
         2.0
diff --git a/test/sql-tap/numcast.test.lua b/test/sql-tap/numcast.test.lua
index 763708d76..62ea9e695 100755
--- a/test/sql-tap/numcast.test.lua
+++ b/test/sql-tap/numcast.test.lua
@@ -2,6 +2,8 @@
 local test = require("sqltester")
 test:plan(26)
 
+local dec = require('decimal')
+
 --!./tcltestrunner.lua
 -- 2013 March 20
 --
@@ -33,11 +35,11 @@ for _, enc in ipairs({"utf8"}) do
             return x
         end, enc)
     local data = {
-        {"1", "12345.0", 12345.0, 12345},
+        {"1", "12345.0", dec.new(12345.0), 12345},
         {"2", "12345.0e0", 12345.0, 12345},
         {"3", "-12345.0e0", -12345.0, -12345},
-        {"4", "-12345.25", -12345.25, -12345},
-        {"5", "-12345.0", -12345.0, -12345},
+        {"4", "-12345.25", dec.new(-12345.25), -12345},
+        {"5", "-12345.0", dec.new(-12345.0), -12345},
     }
     for _, val in ipairs(data) do
         local idx = val[1]
@@ -71,7 +73,7 @@ end
 test:do_execsql_test(
     "cast-2.1",
     [[
-        SELECT CAST((9223372036854775297.01) AS INTEGER);
+        SELECT CAST((9223372036854775297.01e0) AS INTEGER);
     ]], {
         9223372036854775808ULL
     })
@@ -79,7 +81,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.2",
     [[
-        SELECT CAST((18000000000000000000.) AS INTEGER);
+        SELECT CAST((18000000000000000000e0) AS INTEGER);
     ]], {
         18000000000000000000ULL
     })
@@ -87,7 +89,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.3",
     [[
-        SELECT CAST((9223372036854775297.01) AS UNSIGNED);
+        SELECT CAST((9223372036854775297.01e0) AS UNSIGNED);
     ]], {
         9223372036854775808ULL
     })
@@ -95,7 +97,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.4",
     [[
-        SELECT CAST((18000000000000000000.) AS UNSIGNED);
+        SELECT CAST((18000000000000000000e0) AS UNSIGNED);
     ]], {
         18000000000000000000ULL
     })
@@ -103,7 +105,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "cast-2.5",
     [[
-        SELECT CAST((20000000000000000000.) AS UNSIGNED);
+        SELECT CAST((20000000000000000000e0) AS UNSIGNED);
     ]], {
         1,"Type mismatch: can not convert double(2.0e+19) to unsigned"
     })
@@ -112,7 +114,7 @@ test:do_execsql_test(
     "cast-2.6",
     [[
         CREATE TABLE t (i INTEGER PRIMARY KEY);
-        INSERT INTO t VALUES(9223372036854775297.01);
+        INSERT INTO t VALUES(9223372036854775297.01e0);
         SELECT * FROM t;
     ]], {
         9223372036854775808ULL
@@ -121,7 +123,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.7",
     [[
-        INSERT INTO t VALUES(18000000000000000000.01);
+        INSERT INTO t VALUES(18000000000000000000.01e0);
         SELECT * FROM t;
     ]], {
         9223372036854775808ULL,18000000000000000000ULL
@@ -130,7 +132,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "cast-2.8",
     [[
-        INSERT INTO t VALUES(20000000000000000000.01);
+        INSERT INTO t VALUES(20000000000000000000.01e0);
         SELECT * FROM t;
     ]], {
         1,"Type mismatch: can not convert double(2.0e+19) to integer"
@@ -139,7 +141,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-2.9",
     [[
-        INSERT INTO t VALUES(2.1);
+        INSERT INTO t VALUES(2.1e0);
     ]], {
         1, "Type mismatch: can not convert double(2.1) to integer"
     })
@@ -147,7 +149,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "numcast-3.8",
     [[
-        SELECT (1 + 0) / 3, (1 + 0.) / 3, (1 + 0) / 3.;
+        SELECT (1 + 0) / 3, (1 + 0e0) / 3, (1 + 0) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -155,7 +157,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.9",
     [[
-        SELECT (1 - 0) / 3, (1 - 0.) / 3, (1 - 0) / 3.;
+        SELECT (1 - 0) / 3, (1 - 0e0) / 3, (1 - 0) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -163,7 +165,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.10",
     [[
-        SELECT (1 * 1) / 3, (1 * 1.) / 3, (1 * 1) / 3.;
+        SELECT (1 * 1) / 3, (1 * 1e0) / 3, (1 * 1) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -171,7 +173,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.11",
     [[
-        SELECT (1 / 1) / 3, (1 / 1.) / 3, (1 / 1) / 3.;
+        SELECT (1 / 1) / 3, (1 / 1e0) / 3, (1 / 1) / 3e0;
     ]], {
         0 , 0.33333333333333, 0.33333333333333
 })
@@ -183,7 +185,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "numcast-4",
     [[
-        SELECT CAST(-2.5 AS UNSIGNED);
+        SELECT CAST(-2.5e0 AS UNSIGNED);
     ]], {
         1, "Type mismatch: can not convert double(-2.5) to unsigned"
 })
@@ -195,7 +197,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "numcast-5",
     [[
-        SELECT CAST(-0.999 AS INTEGER), CAST(-0.111 AS UNSIGNED);
+        SELECT CAST(-0.999e0 AS INTEGER), CAST(-0.111e0 AS UNSIGNED);
     ]], {
         0, 0
 })
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index e89c7d2f8..8164b8219 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1157,7 +1157,7 @@ test:do_test(
     function()
         set_full_column_names(true)
         return test:execsql2 [[
-            SELECT 123.45;
+            SELECT 123.45e0;
         ]]
     end, {
         -- <select1-6.9.5>
@@ -1481,7 +1481,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "select1-8.1",
     [[
-        SELECT f1 FROM test1 WHERE 4.3+2.4 OR 1 ORDER BY f1
+        SELECT f1 FROM test1 WHERE 4.3e0+2.4e0 OR 1 ORDER BY f1
     ]], {
         -- <select1-8.1>
         1, 'Type mismatch: can not convert double(6.7) to boolean'
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index 465800940..384641e08 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -759,7 +759,7 @@ test:do_test(
     "select4-8.1",
     function()
         test:execsql [[
-            CREATE TABLE t3(a text primary key, b NUMBER, c text);
+            CREATE TABLE t3(a text primary key, b DOUBLE, c text);
             START TRANSACTION;
             INSERT INTO t3 VALUES('1', 1.1, '1.1');
             INSERT INTO t3 VALUES('2', 1.10, '1.10');
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index 88f108f57..f5bd75cb8 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -443,7 +443,7 @@ for ii = 3, 6, 1 do
             SELECT x, y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) ORDER BY 1;
@@ -457,7 +457,7 @@ for ii = 3, 6, 1 do
             SELECT x, y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 LEFT JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 LEFT JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) ORDER BY 1;
@@ -471,7 +471,7 @@ for ii = 3, 6, 1 do
             SELECT x+y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 LEFT JOIN t2 ON (c=d)
+              SELECT a*10 + 0.1e0, f*10 + 0.1e0 FROM t1 LEFT JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) WHERE y+x IS NOT NULL ORDER BY 1;
diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
index 68a0ecbd2..d3f32bfb6 100755
--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -632,7 +632,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "sort-8.1",
     [[
-        CREATE TABLE t5(a NUMBER, b text PRIMARY KEY);
+        CREATE TABLE t5(a DOUBLE, b text PRIMARY KEY);
         INSERT INTO t5 VALUES(100,'A1');
         INSERT INTO t5 VALUES(100.0,'A2');
         SELECT * FROM t5 ORDER BY a, b;
diff --git a/test/sql-tap/tkt-9a8b09f8e6.test.lua b/test/sql-tap/tkt-9a8b09f8e6.test.lua
index cc321c2f6..983c8df2a 100755
--- a/test/sql-tap/tkt-9a8b09f8e6.test.lua
+++ b/test/sql-tap/tkt-9a8b09f8e6.test.lua
@@ -46,7 +46,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.3,
     [[
-        CREATE TABLE t3(x NUMBER primary key);
+        CREATE TABLE t3(x DOUBLE primary key);
         INSERT INTO t3 VALUES(1.0);
     ]], {
         -- <1.3>
@@ -57,7 +57,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.4,
     [[
-        CREATE TABLE t4(x NUMBER primary key);
+        CREATE TABLE t4(x DOUBLE primary key);
         INSERT INTO t4 VALUES(1.11);
     ]], {
         -- <1.4>
@@ -92,7 +92,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     2.2,
     [[
-        SELECT x FROM t1 WHERE x IN (1.0);
+        SELECT x FROM t1 WHERE x IN (1e0);
     ]], {
         -- <2.2>
         1, "Type mismatch: can not convert double(1.0) to string"
@@ -132,7 +132,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     2.6,
     [[
-        SELECT x FROM t1 WHERE 1.0 IN (x);
+        SELECT x FROM t1 WHERE 1e0 IN (x);
     ]], {
         -- <2.6>
         1, "Type mismatch: can not convert double(1.0) to string"
@@ -225,7 +225,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE x IN ('1');
     ]], {
         -- <4.3>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </4.3>
     })
 
@@ -235,7 +235,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE x IN ('1.0');
     ]], {
         -- <4.4>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </4.4>
     })
 
@@ -265,7 +265,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE '1' IN (x);
     ]], {
         -- <4.7>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </4.7>
     })
 
@@ -275,7 +275,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE '1.0' IN (x);
     ]], {
         -- <4.8>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </4.8>
     })
 
@@ -305,7 +305,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1');
     ]], {
         -- <5.3>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </5.3>
     })
 
@@ -315,7 +315,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1.0');
     ]], {
         -- <5.4>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </5.4>
     })
 
@@ -335,7 +335,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1.11');
     ]], {
         -- <5.6>
-        1, "Type mismatch: can not convert string('1.11') to number"
+        1, "Type mismatch: can not convert string('1.11') to double"
         -- </5.6>
     })
 
@@ -365,7 +365,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1' IN (x);
     ]], {
         -- <5.9>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </5.9>
     })
 
@@ -375,7 +375,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1.0' IN (x);
     ]], {
         -- <5.10>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </5.10>
     })
 
@@ -395,7 +395,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1.11' IN (x);
     ]], {
         -- <5.12>
-        1, "Type mismatch: can not convert string('1.11') to number"
+        1, "Type mismatch: can not convert string('1.11') to double"
         -- </5.12>
     })
 
diff --git a/test/sql-tap/tkt-a8a0d2996a.test.lua b/test/sql-tap/tkt-a8a0d2996a.test.lua
index a40621f41..37dc377a8 100755
--- a/test/sql-tap/tkt-a8a0d2996a.test.lua
+++ b/test/sql-tap/tkt-a8a0d2996a.test.lua
@@ -125,7 +125,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     4.0,
     [[
-        SELECT 1+1.;
+        SELECT 1+1e0;
     ]], {
         -- <4.0>
         2.0
diff --git a/test/sql-tap/types.test.lua b/test/sql-tap/types.test.lua
index 4e98e18b1..b86fb4db3 100755
--- a/test/sql-tap/types.test.lua
+++ b/test/sql-tap/types.test.lua
@@ -165,7 +165,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "types-2.2.1",
     [[
-        CREATE TABLE t2(id  INT primary key, a NUMBER);
+        CREATE TABLE t2(id  INT primary key, a DOUBLE);
         INSERT INTO t2 VALUES(1, 0.0);
         INSERT INTO t2 VALUES(2, 12345.678);
         INSERT INTO t2 VALUES(3, -12345.678);
diff --git a/test/sql-tap/uuid.test.lua b/test/sql-tap/uuid.test.lua
index fea9d9370..d6c53d123 100755
--- a/test/sql-tap/uuid.test.lua
+++ b/test/sql-tap/uuid.test.lua
@@ -339,7 +339,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "uuid-6.1.15",
     [[
-        SELECT LIKELIHOOD(u, 0.5) from t2;
+        SELECT LIKELIHOOD(u, 0.5e0) from t2;
     ]], {
         uuid1, uuid3, uuid2
     })
@@ -651,7 +651,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-7.2.4",
     [[
-        SELECT cast(1.5 AS UUID);
+        SELECT cast(1.5e0 AS UUID);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -804,7 +804,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-8.2.4",
     [[
-        INSERT INTO tsu VALUES ('4_double', 1.5);
+        INSERT INTO tsu VALUES ('4_double', 1.5e0);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -1098,7 +1098,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-13.1.4",
     [[
-        SELECT u > 1.5 FROM t2;
+        SELECT u > 1.5e0 FROM t2;
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -1162,7 +1162,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-13.2.4",
     [[
-        SELECT u = 1.5 FROM t2;
+        SELECT u = 1.5e0 FROM t2;
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index 58e5d3e0b..2c424454d 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -23,7 +23,7 @@ test:do_test(
     "whereA-1.1",
     function()
         return test:execsql [[
-            CREATE TABLE t1(a INTEGER PRIMARY KEY, b NUMBER UNIQUE, c TEXT);
+            CREATE TABLE t1(a INTEGER PRIMARY KEY, b DOUBLE UNIQUE, c TEXT);
             INSERT INTO t1 VALUES(1,2,'3');
             INSERT INTO t1 values(2,55,'world');
             INSERT INTO t1 VALUES(3,4.53,NULL);
diff --git a/test/sql-tap/whereG.test.lua b/test/sql-tap/whereG.test.lua
index 49501a4a5..8d91b7978 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -103,7 +103,7 @@ test:do_eqp_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', 0.5)
+         WHERE likelihood(cname LIKE '%bach%', 0.5e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -117,7 +117,7 @@ test:do_execsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%' COLLATE "unicode_ci", 0.5)
+         WHERE likelihood(cname LIKE '%bach%' COLLATE "unicode_ci", 0.5e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -187,7 +187,7 @@ test:do_catchsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', -0.01)
+         WHERE likelihood(cname LIKE '%bach%', -0.1e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -201,7 +201,7 @@ test:do_catchsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', 1.01)
+         WHERE likelihood(cname LIKE '%bach%', 1.01e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -370,7 +370,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "7.2",
     [[
-        SELECT likelihood(a,0.5), x FROM t1, t2 ORDER BY 1, 2;
+        SELECT likelihood(a, 0.5e0), x FROM t1, t2 ORDER BY 1, 2;
     ]], {
         -- <7.2>
         1, 3, 1, 4, 9, 3, 9, 4
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 761004b23..2aa9f0aca 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -534,10 +534,10 @@ test:do_catchsql_test(7.6, [[
 --
 test:do_execsql_test("8.1-mandelbrot", [[
   WITH RECURSIVE
-    xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2),
-    yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0),
+    xaxis(x) AS (VALUES(-2e0) UNION ALL SELECT x + 0.05e0 FROM xaxis WHERE x < 1.2e0),
+    yaxis(y) AS (VALUES(-1e0) UNION ALL SELECT y + 0.1e0 FROM yaxis WHERE y < 1.0e0),
     m(iter, cx, cy, x, y) AS (
-      SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis
+      SELECT 0, x, y, 0e0, 0e0 FROM xaxis, yaxis
       UNION ALL
       SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m
        WHERE (x*x + y*y) < 4.0 AND iter<28
diff --git a/test/sql/boolean.result b/test/sql/boolean.result
index 75a091cce..984529f64 100644
--- a/test/sql/boolean.result
+++ b/test/sql/boolean.result
@@ -546,12 +546,12 @@ SELECT cast(0 AS BOOLEAN);
 SELECT cast(0.123 AS BOOLEAN);
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.123) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.123) to boolean'
  | ...
 SELECT cast(0.0 AS BOOLEAN);
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.0) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.0) to boolean'
  | ...
 SELECT cast('true' AS BOOLEAN), cast('false' AS BOOLEAN);
  | ---
@@ -3920,7 +3920,7 @@ INSERT INTO t8 VALUES (4.56);
 SELECT true AND 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false AND 2.3;
  | ---
@@ -3933,17 +3933,17 @@ SELECT false AND 2.3;
 SELECT true OR 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false OR 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 AND true;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 AND false;
  | ---
@@ -3956,53 +3956,53 @@ SELECT 2.3 AND false;
 SELECT 2.3 OR true;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 OR false;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 
 SELECT a1, a1 AND 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 OR 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 AND a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 OR a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 AND 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 OR 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 AND a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 OR a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 
 SELECT c, true AND c FROM t8;
@@ -4140,12 +4140,12 @@ SELECT false / 2.3;
 SELECT true % 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT false % 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT 2.3 + true;
  | ---
@@ -4221,7 +4221,7 @@ SELECT a1, a1 / 2.3 FROM t6
 SELECT a1, a1 % 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT a1, 2.3 + a1 FROM t6
  | ---
@@ -4271,7 +4271,7 @@ SELECT a2, a2 / 2.3 FROM t6
 SELECT a2, a2 % 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT a2, 2.3 + a2 FROM t6
  | ---
@@ -4504,22 +4504,22 @@ SELECT a2, c, c % a2 FROM t6, t8;
 SELECT true > 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false > 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true < 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false < 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 > true;
  | ---
@@ -4545,12 +4545,12 @@ SELECT 2.3 < false;
 SELECT a1, a1 > 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 < 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 > a1 FROM t6
  | ---
@@ -4565,12 +4565,12 @@ SELECT a1, 2.3 < a1 FROM t6
 SELECT a2, a2 > 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 < 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 > a2 FROM t6
  | ---
@@ -4668,22 +4668,22 @@ SELECT a2, c, c < a2 FROM t6, t8;
 SELECT true >= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false >= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true <= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false <= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 >= true;
  | ---
@@ -4709,12 +4709,12 @@ SELECT 2.3 <= false;
 SELECT a1, a1 >= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 <= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 >= a1 FROM t6
  | ---
@@ -4729,12 +4729,12 @@ SELECT a1, 2.3 <= a1 FROM t6
 SELECT a2, a2 >= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 <= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 >= a2 FROM t6
  | ---
@@ -4832,22 +4832,22 @@ SELECT a2, c, c <= a2 FROM t6, t8;
 SELECT true == 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false == 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true != 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false != 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 == true;
  | ---
@@ -4873,12 +4873,12 @@ SELECT 2.3 != false;
 SELECT a1, a1 == 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 != 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 == a1 FROM t6
  | ---
@@ -4893,12 +4893,12 @@ SELECT a1, 2.3 != a1 FROM t6
 SELECT a2, a2 == 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 != 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 == a2 FROM t6
  | ---
@@ -5049,22 +5049,22 @@ SELECT a2 IN (SELECT c FROM t8) FROM t6 LIMIT 1;
 SELECT true BETWEEN 0.1 and 9.9;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT false BETWEEN 0.1 and 9.9;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT a1, a1 BETWEEN 0.1 and 9.9 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT a2, a2 BETWEEN 0.1 and 9.9 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 
 -- Check interaction of BOOLEAN and TEXT.
diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
index 5fd2b79c0..efc0a7493 100644
--- a/test/sql/func-recreate.result
+++ b/test/sql/func-recreate.result
@@ -25,7 +25,7 @@ test_run:cmd("setopt delimiter ''");
 ch = fiber.channel(1)
 ---
 ...
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2)')) end)
+_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2e0)')) end)
 ---
 ...
 fiber.sleep(0.1)
diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
index b76789f86..d0132f120 100644
--- a/test/sql/func-recreate.test.lua
+++ b/test/sql/func-recreate.test.lua
@@ -13,7 +13,7 @@ test_run:cmd("setopt delimiter ''");
 
 ch = fiber.channel(1)
 
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2)')) end)
+_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2e0)')) end)
 fiber.sleep(0.1)
 
 box.func.WAITFOR:drop()
diff --git a/test/sql/gh-3888-values-blob-assert.result b/test/sql/gh-3888-values-blob-assert.result
index 669f2eb2f..ce3f58cdc 100644
--- a/test/sql/gh-3888-values-blob-assert.result
+++ b/test/sql/gh-3888-values-blob-assert.result
@@ -69,7 +69,7 @@ box.execute('SELECT 3.14')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [3.14]
 ...
diff --git a/test/sql/integer-overflow.result b/test/sql/integer-overflow.result
index 8cad30ef3..91958d4e9 100644
--- a/test/sql/integer-overflow.result
+++ b/test/sql/integer-overflow.result
@@ -114,7 +114,7 @@ box.execute('SELECT CAST(\'18446744073709551616\' AS INTEGER);')
 -- float 18446744073709551600 -> int (18446744073709551616),
 -- with error due to conversion = 16.
 --
-box.execute('SELECT CAST(18446744073709551600. AS INTEGER);')
+box.execute('SELECT CAST(18446744073709551600e0 AS INTEGER);')
 ---
 - null
 - 'Type mismatch: can not convert double(1.84467440737096e+19) to integer'
diff --git a/test/sql/integer-overflow.test.lua b/test/sql/integer-overflow.test.lua
index 2ac97995a..5a9ebca19 100644
--- a/test/sql/integer-overflow.test.lua
+++ b/test/sql/integer-overflow.test.lua
@@ -32,7 +32,7 @@ box.execute('SELECT CAST(\'18446744073709551616\' AS INTEGER);')
 -- float 18446744073709551600 -> int (18446744073709551616),
 -- with error due to conversion = 16.
 --
-box.execute('SELECT CAST(18446744073709551600. AS INTEGER);')
+box.execute('SELECT CAST(18446744073709551600e0 AS INTEGER);')
 -- gh-3810: make sure that if space contains integers in range
 -- [INT64_MAX, UINT64_MAX], they are handled inside SQL in a
 -- proper way, which now means that an error is raised.
diff --git a/test/sql/misc.result b/test/sql/misc.result
index 91464ec33..c3c0b161b 100644
--- a/test/sql/misc.result
+++ b/test/sql/misc.result
@@ -87,12 +87,28 @@ box.execute('SELECT 1.5;')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [1.5]
 ...
 box.execute('SELECT 1.0;')
 ---
+- metadata:
+  - name: COLUMN_1
+    type: decimal
+  rows:
+  - [1.0]
+...
+box.execute('SELECT 1.5e0;')
+---
+- metadata:
+  - name: COLUMN_1
+    type: double
+  rows:
+  - [1.5]
+...
+box.execute('SELECT 1e0;')
+---
 - metadata:
   - name: COLUMN_1
     type: double
diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
index 8de7366b1..8b34d1071 100644
--- a/test/sql/misc.test.lua
+++ b/test/sql/misc.test.lua
@@ -24,6 +24,8 @@ box.execute('CREATE TABLE test (id INTEGER PRIMARY KEY, b TEXT CONSTRAINT c1 COL
 box.execute('SELECT 1;')
 box.execute('SELECT 1.5;')
 box.execute('SELECT 1.0;')
+box.execute('SELECT 1.5e0;')
+box.execute('SELECT 1e0;')
 box.execute('SELECT \'abc\';')
 box.execute('SELECT X\'4D6564766564\'')
 
diff --git a/test/sql/types.result b/test/sql/types.result
index b8e0d1fcb..947795b03 100644
--- a/test/sql/types.result
+++ b/test/sql/types.result
@@ -163,7 +163,7 @@ box.execute("SELECT 'abc' || 1;")
 box.execute("SELECT 'abc' || 1.123;")
 ---
 - null
-- 'Inconsistent types: expected string or varbinary got double(1.123)'
+- 'Inconsistent types: expected string or varbinary got decimal(1.123)'
 ...
 box.execute("SELECT 1 || 'abc';")
 ---
@@ -173,7 +173,7 @@ box.execute("SELECT 1 || 'abc';")
 box.execute("SELECT 1.123 || 'abc';")
 ---
 - null
-- 'Inconsistent types: expected string or varbinary got double(1.123)'
+- 'Inconsistent types: expected string or varbinary got decimal(1.123)'
 ...
 box.execute("SELECt 'a' || 'b' || 1;")
 ---
@@ -298,7 +298,7 @@ box.execute('SELECT 1 + 1.1;')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [2.1]
 ...
@@ -346,7 +346,7 @@ box.execute("SELECT * FROM tboolean WHERE s1 = 1;")
 box.execute("SELECT * FROM tboolean WHERE s1 = 1.123;")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to boolean'
+- 'Type mismatch: can not convert decimal(1.123) to boolean'
 ...
 box.space.TBOOLEAN:drop()
 ---
@@ -463,7 +463,8 @@ box.execute("SELECT a FROM t1 WHERE a IN (1.1, 2.1);")
 - metadata:
   - name: A
     type: unsigned
-  rows: []
+  rows:
+  - [1]
 ...
 s:drop()
 ---
@@ -582,7 +583,7 @@ box.execute("SELECT 18446744073709551615 = null;")
   rows:
   - [null]
 ...
-box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
+box.execute("SELECT 18446744073709551615 = 18446744073709551615e0;")
 ---
 - metadata:
   - name: COLUMN_1
@@ -590,7 +591,7 @@ box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
   rows:
   - [false]
 ...
-box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
+box.execute("SELECT 18446744073709551615e0 > 18446744073709551615")
 ---
 - metadata:
   - name: COLUMN_1
@@ -598,7 +599,7 @@ box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
   rows:
   - [true]
 ...
-box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615.0)")
+box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615e0)")
 ---
 - null
 - 'Type mismatch: can not convert integer(18446744073709551615) to string'
@@ -1075,7 +1076,7 @@ box.execute("SELECT CAST(1.5 AS UNSIGNED);")
 box.execute("SELECT CAST(-1.5 AS UNSIGNED);")
 ---
 - null
-- 'Type mismatch: can not convert double(-1.5) to unsigned'
+- 'Type mismatch: can not convert decimal(-1.5) to unsigned'
 ...
 box.execute("SELECT CAST(true AS UNSIGNED);")
 ---
@@ -1192,7 +1193,7 @@ box.execute("INSERT INTO t VALUES(1, 1);")
 box.execute("INSERT INTO t VALUES(1, 1.123);")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("INSERT INTO t VALUES(1, true);")
 ---
@@ -1216,7 +1217,7 @@ box.execute("SELECT * FROM t WHERE v = 1")
 box.execute("SELECT * FROM t WHERE v = 1.123")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("SELECT * FROM t WHERE v = 'str'")
 ---
@@ -1424,7 +1425,7 @@ box.execute("SELECT CAST(1 AS VARBINARY);")
 box.execute("SELECT CAST(1.123 AS VARBINARY);")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("SELECT CAST(true AS VARBINARY);")
 ---
@@ -1657,15 +1658,15 @@ box.execute("SELECT 1.0;")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
-  - [1]
+  - [1.0]
 ...
 box.execute("SELECT .01;")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [0.01]
 ...
@@ -2031,11 +2032,11 @@ box.execute("SELECT 1.0, typeof(1.0);")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   - name: COLUMN_2
     type: string
   rows:
-  - [1, 'double']
+  - [1.0, 'decimal']
 ...
 box.execute("SELECT CAST(2 AS DOUBLE), typeof(CAST(2 AS DOUBLE));")
 ---
@@ -2146,7 +2147,7 @@ box.execute([[INSERT INTO ti(i) VALUES (11);]])
   - 2
   row_count: 1
 ...
-box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1);]])
+box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1e0);]])
 ---
 - null
 - 'Type mismatch: can not convert double(1.0e+32) to integer'
@@ -2248,7 +2249,7 @@ box.execute([[INSERT INTO tb(b) VALUES (11);]])
 box.execute([[INSERT INTO tb(b) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to boolean'
+- 'Type mismatch: can not convert decimal(22.2) to boolean'
 ...
 box.execute([[INSERT INTO tb(b) VALUES (true);]])
 ---
@@ -2291,7 +2292,7 @@ box.execute([[INSERT INTO tt(t) VALUES (11);]])
 box.execute([[INSERT INTO tt(t) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to string'
+- 'Type mismatch: can not convert decimal(22.2) to string'
 ...
 box.execute([[INSERT INTO tt(t) VALUES (true);]])
 ---
@@ -2334,7 +2335,7 @@ box.execute([[INSERT INTO tv(v) VALUES (11);]])
 box.execute([[INSERT INTO tv(v) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to varbinary'
+- 'Type mismatch: can not convert decimal(22.2) to varbinary'
 ...
 box.execute([[INSERT INTO tv(v) VALUES (true);]])
 ---
@@ -2501,7 +2502,7 @@ box.execute([[UPDATE ti SET i = 11 WHERE a = 1;]])
 ---
 - row_count: 1
 ...
-box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1 WHERE a = 1;]])
+box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1e0 WHERE a = 1;]])
 ---
 - null
 - 'Type mismatch: can not convert double(1.0e+32) to integer'
@@ -2589,7 +2590,7 @@ box.execute([[UPDATE tb SET b = 11 WHERE a = 1;]])
 box.execute([[UPDATE tb SET b = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to boolean'
+- 'Type mismatch: can not convert decimal(22.2) to boolean'
 ...
 box.execute([[UPDATE tb SET b = true WHERE a = 1;]])
 ---
@@ -2627,7 +2628,7 @@ box.execute([[UPDATE tt SET t = 11 WHERE a = 1;]])
 box.execute([[UPDATE tt SET t = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to string'
+- 'Type mismatch: can not convert decimal(22.2) to string'
 ...
 box.execute([[UPDATE tt SET t = true WHERE a = 1;]])
 ---
@@ -2665,7 +2666,7 @@ box.execute([[UPDATE tv SET v = 11 WHERE a = 1;]])
 box.execute([[UPDATE tv SET v = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to varbinary'
+- 'Type mismatch: can not convert decimal(22.2) to varbinary'
 ...
 box.execute([[UPDATE tv SET v = true WHERE a = 1;]])
 ---
diff --git a/test/sql/types.test.lua b/test/sql/types.test.lua
index 0270d9f8a..e9b5012af 100644
--- a/test/sql/types.test.lua
+++ b/test/sql/types.test.lua
@@ -149,9 +149,9 @@ box.execute("SELECT -1 < 18446744073709551615;")
 box.execute("SELECT -1 > 18446744073709551615;")
 box.execute("SELECT 18446744073709551610 - 18446744073709551615;")
 box.execute("SELECT 18446744073709551615 = null;")
-box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
-box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
-box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615.0)")
+box.execute("SELECT 18446744073709551615 = 18446744073709551615e0;")
+box.execute("SELECT 18446744073709551615e0 > 18446744073709551615")
+box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615e0)")
 box.execute("SELECT 1 LIMIT 18446744073709551615;")
 box.execute("SELECT 1 LIMIT 1 OFFSET 18446744073709551614;")
 box.execute("SELECT CAST('18446744073' || '709551616' AS INTEGER);")
@@ -504,7 +504,7 @@ box.execute([[CREATE TABLE ts (a INT PRIMARY KEY AUTOINCREMENT, s SCALAR);]])
 
 box.execute([[INSERT INTO ti(i) VALUES (NULL);]])
 box.execute([[INSERT INTO ti(i) VALUES (11);]])
-box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1);]])
+box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1e0);]])
 box.execute([[INSERT INTO ti(i) VALUES (33.0);]])
 box.execute([[INSERT INTO ti(i) VALUES (true);]])
 box.execute([[INSERT INTO ti(i) VALUES ('33');]])
@@ -569,7 +569,7 @@ box.execute([[SELECT * FROM ti, td, tb, tt, tv, ts;]])
 
 box.execute([[UPDATE ti SET i = NULL WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = 11 WHERE a = 1;]])
-box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1 WHERE a = 1;]])
+box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1e0 WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = 33.0 WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = true WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = '33' WHERE a = 1;]])

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Tarantool-patches] [PATCH v1 1/1] sql: introduce literals for DECIMAL
  2021-10-04 13:35 Mergen Imeev via Tarantool-patches
@ 2021-10-08 22:32 ` Vladislav Shpilevoy via Tarantool-patches
  2021-10-19  8:49   ` Mergen Imeev via Tarantool-patches
  0 siblings, 1 reply; 6+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-10-08 22:32 UTC (permalink / raw)
  To: imeevma; +Cc: tarantool-patches

Thanks for the patch!

See 5 comments below.

> diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
> index ee21c1ede..2b156284c 100644
> --- a/src/box/sql/expr.c
> +++ b/src/box/sql/expr.c
> @@ -3286,6 +3286,27 @@ codeReal(Vdbe * v, const char *z, int negateFlag, int iMem)
>  	}
>  }
>  
> +static void
> +expr_code_dec(struct Parse *parser, struct Expr *expr, bool is_neg, int reg)
> +{
> +	const char *str = expr->u.zToken;
> +	assert(str != NULL);
> +	decimal_t dec;
> +	if (is_neg)
> +		str = tt_sprintf("-%s", str);
> +	if (decimal_from_string(&dec, str) == NULL) {
> +		parser->is_aborted = true;
> +		return;
> +	}
> +	char *value = sqlDbMallocRawNN(sql_get(), sizeof(dec));
> +	if (value == NULL) {
> +		parser->is_aborted = true;
> +		return;
> +	}
> +	memcpy(value, &dec, sizeof(dec));
> +	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, value, P4_DEC);

1. memcpy() is not needed. For the positive case for sure. For the
negative too, but I didn't bench what is faster - tt_sprintf() or
decimal_minus().

====================
diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index 2b156284c..cce0e5030 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -3291,20 +3291,22 @@ expr_code_dec(struct Parse *parser, struct Expr *expr, bool is_neg, int reg)
 {
 	const char *str = expr->u.zToken;
 	assert(str != NULL);
-	decimal_t dec;
-	if (is_neg)
-		str = tt_sprintf("-%s", str);
-	if (decimal_from_string(&dec, str) == NULL) {
-		parser->is_aborted = true;
-		return;
-	}
-	char *value = sqlDbMallocRawNN(sql_get(), sizeof(dec));
-	if (value == NULL) {
-		parser->is_aborted = true;
-		return;
+	decimal_t *value = sqlDbMallocRawNN(sql_get(), sizeof(*value));
+	if (value == NULL)
+		goto error;
+	if (is_neg) {
+		decimal_t dec;
+		if (decimal_from_string(&dec, str) == NULL)
+			goto error;
+		decimal_minus(value, &dec);
+	} else if (decimal_from_string(value, str) == NULL) {
+		goto error;
 	}
-	memcpy(value, &dec, sizeof(dec));
 	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, value, P4_DEC);
+	return;
+error:
+	sqlDbFree(sql_get(), value);
+	parser->is_aborted = true;
 }
====================

> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index 44533fb3e..747fb608b 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -804,6 +804,17 @@ case OP_Real: {            /* same as TK_FLOAT, out2 */
>  	break;
>  }
>  
> +/* Opcode: Decimal * P2 * P4 *
> + * Synopsis: r[P2]=P4
> + *
> + * P4 is a pointer to a DECIMAL value. Write that value into register P2.
> + */
> +case OP_Decimal: {            /* same as TK_DECIMAL, out2 */

2. Lets stick to our code style when write comments:
start them with /** out of functions, and not write them
on the same line as code.

> +	pOut = vdbe_prepare_null_out(p, pOp->p2);
> +	mem_set_dec(pOut, pOp->p4.dec);
> +	break;
> +}
> +
>  /* Opcode: String8 * P2 * P4 *
>   * Synopsis: r[P2]='P4'
>   *
> diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h
> index e40a1a0b3..121b86029 100644
> --- a/src/box/sql/vdbe.h
> +++ b/src/box/sql/vdbe.h
> @@ -97,6 +97,8 @@ struct VdbeOp {
>  		 * Information about ephemeral space field types and key parts.
>  		 */

3. Not related to the patch, but wtf P4_REAL is stored by a
pointer? 'double' is 8 bytes, it fits perfectly into this
union. But instead it is copied onto the heap?! Could you
please file a ticket to fix that and store it by value?

>  		struct sql_space_info *space_info;
> +		/** P4 contains address of decimal. */
> +		decimal_t *dec;
>  	} p4;
> diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
> index 68d2ae585..5f8e885ce 100755
> --- a/test/sql-tap/cast.test.lua
> +++ b/test/sql-tap/cast.test.lua
> @@ -962,7 +962,7 @@ test:do_catchsql_test(
>  test:do_catchsql_test(
>      "cast-6.2.3",
>      [[
> -        SELECT CAST(1.5 AS BOOLEAN);
> +        SELECT CAST(15e-1 AS BOOLEAN);

4. It might be more readable to use e0 ending everywhere.
The numbers otherwise become unreadable.

5. Please, add some tests for so large numbers that only
DECIMAL would fit them. To prove that VDBE really uses
decimal for them.

Also need to ensure typeof() returns correct types depending
on the literal.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Tarantool-patches] [PATCH v1 1/1] sql: introduce literals for DECIMAL
@ 2021-10-04 13:35 Mergen Imeev via Tarantool-patches
  2021-10-08 22:32 ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 6+ messages in thread
From: Mergen Imeev via Tarantool-patches @ 2021-10-04 13:35 UTC (permalink / raw)
  To: v.shpilevoy; +Cc: tarantool-patches

Part of #6356

@TarantoolBot document
Title: Literals for INTEGER, DECIMAL and DOUBLE

The rules for parsing numeric values have changed:
1) a value consisting of digits without decimal point and exponent will
be parsed as INTEGER;
2) a value consisting of digits and a decimal point will be parsed as
DECIMAL;
3) a value consisting of digits, containing an exponent and possibly
containing a decimal point, will be parsed as DOUBLE.
---
https://github.com/tarantool/tarantool/issues/6356
https://github.com/tarantool/tarantool/tree/imeevma/gh-6356-literals-for-decimal

 .../gh-6356-literals-for-decimal.md           |  4 +
 src/box/sql/expr.c                            | 28 ++++++
 src/box/sql/parse.y                           |  4 +
 src/box/sql/tokenize.c                        |  2 +-
 src/box/sql/vdbe.c                            | 11 +++
 src/box/sql/vdbe.h                            |  4 +
 src/box/sql/vdbeapi.c                         |  3 +
 src/box/sql/vdbeaux.c                         |  5 +
 test/sql-tap/cast.test.lua                    | 22 ++---
 test/sql-tap/check.test.lua                   |  2 +-
 test/sql-tap/decimal.test.lua                 | 28 +++++-
 test/sql-tap/default.test.lua                 |  4 +-
 test/sql-tap/e_select1.test.lua               | 14 +--
 test/sql-tap/func.test.lua                    | 18 ++--
 test/sql-tap/func3.test.lua                   | 26 ++---
 .../gh-5364-define-bit-wise-rules.test.lua    |  8 +-
 ...-5756-implicit-cast-in-arithmetic.test.lua | 10 +-
 .../gh-6239-quote-with-double-arg.test.lua    |  2 +-
 test/sql-tap/index1.test.lua                  |  2 +-
 test/sql-tap/insert3.test.lua                 |  3 +-
 test/sql-tap/lua_sql.test.lua                 |  4 +-
 test/sql-tap/metatypes.test.lua               |  2 +-
 test/sql-tap/misc5.test.lua                   |  4 +-
 test/sql-tap/numcast.test.lua                 | 38 ++++----
 test/sql-tap/select1.test.lua                 |  4 +-
 test/sql-tap/select4.test.lua                 |  2 +-
 test/sql-tap/selectB.test.lua                 |  6 +-
 test/sql-tap/sort.test.lua                    |  2 +-
 test/sql-tap/tkt-9a8b09f8e6.test.lua          | 28 +++---
 test/sql-tap/tkt-a8a0d2996a.test.lua          |  2 +-
 test/sql-tap/types.test.lua                   |  2 +-
 test/sql-tap/uuid.test.lua                    | 10 +-
 test/sql-tap/whereA.test.lua                  |  2 +-
 test/sql-tap/whereG.test.lua                  | 10 +-
 test/sql-tap/with1.test.lua                   |  6 +-
 test/sql/boolean.result                       | 96 +++++++++----------
 test/sql/func-recreate.result                 |  2 +-
 test/sql/func-recreate.test.lua               |  2 +-
 test/sql/gh-3888-values-blob-assert.result    |  2 +-
 test/sql/integer-overflow.result              |  2 +-
 test/sql/integer-overflow.test.lua            |  2 +-
 test/sql/misc.result                          | 18 +++-
 test/sql/misc.test.lua                        |  2 +
 test/sql/types.result                         | 51 +++++-----
 test/sql/types.test.lua                       | 10 +-
 45 files changed, 305 insertions(+), 204 deletions(-)
 create mode 100644 changelogs/unreleased/gh-6356-literals-for-decimal.md

diff --git a/changelogs/unreleased/gh-6356-literals-for-decimal.md b/changelogs/unreleased/gh-6356-literals-for-decimal.md
new file mode 100644
index 000000000..24b8d7e40
--- /dev/null
+++ b/changelogs/unreleased/gh-6356-literals-for-decimal.md
@@ -0,0 +1,4 @@
+## feature/sql
+
+* A value consisting of digits and a decimal point is now parsed as
+  DECIMAL (gh-6456).
diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index ee21c1ede..2b156284c 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -3286,6 +3286,27 @@ codeReal(Vdbe * v, const char *z, int negateFlag, int iMem)
 	}
 }
 
+static void
+expr_code_dec(struct Parse *parser, struct Expr *expr, bool is_neg, int reg)
+{
+	const char *str = expr->u.zToken;
+	assert(str != NULL);
+	decimal_t dec;
+	if (is_neg)
+		str = tt_sprintf("-%s", str);
+	if (decimal_from_string(&dec, str) == NULL) {
+		parser->is_aborted = true;
+		return;
+	}
+	char *value = sqlDbMallocRawNN(sql_get(), sizeof(dec));
+	if (value == NULL) {
+		parser->is_aborted = true;
+		return;
+	}
+	memcpy(value, &dec, sizeof(dec));
+	sqlVdbeAddOp4(parser->pVdbe, OP_Decimal, 0, reg, 0, value, P4_DEC);
+}
+
 /**
  * Generate an instruction that will put the integer describe by
  * text z[0..n-1] into register iMem.
@@ -3725,6 +3746,10 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 			sqlVdbeAddOp2(v, OP_Bool, op == TK_TRUE, target);
 			return target;
 		}
+	case TK_DECIMAL:{
+			expr_code_dec(pParse, pExpr, false, target);
+			return target;
+		}
 	case TK_FLOAT:{
 			assert(!ExprHasProperty(pExpr, EP_IntValue));
 			codeReal(v, pExpr->u.zToken, 0, target);
@@ -3884,6 +3909,9 @@ sqlExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
 				assert(!ExprHasProperty(pExpr, EP_IntValue));
 				codeReal(v, pLeft->u.zToken, 1, target);
 				return target;
+			} else if (pLeft->op == TK_DECIMAL) {
+				expr_code_dec(pParse, pLeft, true, target);
+				return target;
 			} else {
 				tempX.op = TK_INTEGER;
 				tempX.flags = EP_IntValue | EP_TokenOnly;
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 337df4916..ae480a5d1 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -994,6 +994,9 @@ idlist(A) ::= nm(Y). {
       case TK_FLOAT:
         p->type = FIELD_TYPE_DOUBLE;
         break;
+      case TK_DECIMAL:
+        p->type = FIELD_TYPE_DECIMAL;
+        break;
       case TK_TRUE:
       case TK_FALSE:
       case TK_UNKNOWN:
@@ -1071,6 +1074,7 @@ term(A) ::= STRING(X).     {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= FALSE(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= TRUE(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 term(A) ::= UNKNOWN(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
+term(A) ::= DECIMAL(X) . {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
 
 term(A) ::= INTEGER(X). {
   A.pExpr = sql_expr_new_dequoted(pParse->db, TK_INTEGER, &X);
diff --git a/src/box/sql/tokenize.c b/src/box/sql/tokenize.c
index 0899cf23e..b3cf8f6e6 100644
--- a/src/box/sql/tokenize.c
+++ b/src/box/sql/tokenize.c
@@ -343,7 +343,7 @@ sql_token(const char *z, int *type, bool *is_reserved)
 		if (z[i] == '.') {
 			while (sqlIsdigit(z[++i])) {
 			}
-			*type = TK_FLOAT;
+			*type = TK_DECIMAL;
 		}
 		if ((z[i] == 'e' || z[i] == 'E') &&
 		    (sqlIsdigit(z[i + 1])
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 44533fb3e..747fb608b 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -804,6 +804,17 @@ case OP_Real: {            /* same as TK_FLOAT, out2 */
 	break;
 }
 
+/* Opcode: Decimal * P2 * P4 *
+ * Synopsis: r[P2]=P4
+ *
+ * P4 is a pointer to a DECIMAL value. Write that value into register P2.
+ */
+case OP_Decimal: {            /* same as TK_DECIMAL, out2 */
+	pOut = vdbe_prepare_null_out(p, pOp->p2);
+	mem_set_dec(pOut, pOp->p4.dec);
+	break;
+}
+
 /* Opcode: String8 * P2 * P4 *
  * Synopsis: r[P2]='P4'
  *
diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h
index e40a1a0b3..121b86029 100644
--- a/src/box/sql/vdbe.h
+++ b/src/box/sql/vdbe.h
@@ -97,6 +97,8 @@ struct VdbeOp {
 		 * Information about ephemeral space field types and key parts.
 		 */
 		struct sql_space_info *space_info;
+		/** P4 contains address of decimal. */
+		decimal_t *dec;
 	} p4;
 #ifdef SQL_ENABLE_EXPLAIN_COMMENTS
 	char *zComment;		/* Comment to improve readability */
@@ -132,6 +134,8 @@ struct SubProgram {
 #define P4_COLLSEQ  (-3)	/* P4 is a pointer to a CollSeq structure */
 /** P4 is a pointer to a func structure. */
 #define P4_FUNC     (-4)
+/** P4 is a pointer to a decimal. */
+#define P4_DEC      (-5)
 #define P4_MEM      (-7)	/* P4 is a pointer to a Mem*    structure */
 #define P4_TRANSIENT  0		/* P4 is a pointer to a transient string */
 #define P4_REAL     (-9)	/* P4 is a 64-bit floating point value */
diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
index 115940227..22c6bd656 100644
--- a/src/box/sql/vdbeapi.c
+++ b/src/box/sql/vdbeapi.c
@@ -563,6 +563,9 @@ sql_stmt_est_size(const struct sql_stmt *stmt)
 		case P4_REAL:
 			size += sizeof(*v->aOp[i].p4.pReal);
 			break;
+		case P4_DEC:
+			size += sizeof(*v->aOp[i].p4.dec);
+			break;
 		default:
 			size += sizeof(v->aOp[i].p4.p);
 			break;
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index 8148ed8b0..4ce08359c 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -605,6 +605,7 @@ freeP4(sql * db, int p4type, void *p4)
 			freeP4FuncCtx(db, (sql_context *) p4);
 			break;
 		}
+	case P4_DEC:
 	case P4_REAL:
 	case P4_INT64:
 	case P4_UINT64:
@@ -1095,6 +1096,10 @@ displayP4(Op * pOp, char *zTemp, int nTemp)
 			sqlXPrintf(&x, "%.16g", *pOp->p4.pReal);
 			break;
 		}
+	case P4_DEC:{
+			sqlXPrintf(&x, "%s", decimal_str(pOp->p4.dec));
+			break;
+		}
 	case P4_MEM:{
 			const char *value = mem_str(pOp->p4.pMem);
 			sqlStrAccumAppend(&x, value, strlen(value));
diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
index 68d2ae585..5f8e885ce 100755
--- a/test/sql-tap/cast.test.lua
+++ b/test/sql-tap/cast.test.lua
@@ -307,7 +307,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.31",
     [[
-        SELECT 123.456
+        SELECT 123.456e0
     ]], {
         -- <cast-1.31>
         123.456
@@ -317,7 +317,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.32",
     [[
-        SELECT typeof(123.456)
+        SELECT typeof(123.456e0)
     ]], {
         -- <cast-1.32>
         "double"
@@ -337,7 +337,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.34",
     [[
-        SELECT typeof(CAST(123.456 AS text))
+        SELECT typeof(CAST(123.456e0 AS text))
     ]], {
         -- <cast-1.34>
         "string"
@@ -347,7 +347,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.35",
     [[
-        SELECT CAST(123.456 AS NUMBER)
+        SELECT CAST(123.456e0 AS NUMBER)
     ]], {
         -- <cast-1.35>
         123.456
@@ -357,7 +357,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.36",
     [[
-        SELECT typeof(CAST(123.456 AS DOUBLE))
+        SELECT typeof(CAST(123.456e0 AS DOUBLE))
     ]], {
         -- <cast-1.36>
         "double"
@@ -367,7 +367,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.37",
     [[
-        SELECT CAST(123.456 AS SCALAR)
+        SELECT CAST(123.456e0 AS SCALAR)
     ]], {
         -- <cast-1.37>
         123.456
@@ -377,7 +377,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.38",
     [[
-        SELECT typeof(CAST(123.456 AS SCALAR))
+        SELECT typeof(CAST(123.456e0 AS SCALAR))
     ]], {
         -- <cast-1.38>
         "scalar"
@@ -387,7 +387,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.39",
     [[
-        SELECT CAST(123.456 AS integer)
+        SELECT CAST(123.456e0 AS integer)
     ]], {
         -- <cast-1.39>
         123
@@ -397,7 +397,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-1.38",
     [[
-        SELECT typeof(CAST(123.456 AS integer))
+        SELECT typeof(CAST(123.456e0 AS integer))
     ]], {
         -- <cast-1.38>
         "integer"
@@ -962,7 +962,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-6.2.3",
     [[
-        SELECT CAST(1.5 AS BOOLEAN);
+        SELECT CAST(15e-1 AS BOOLEAN);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to boolean"
     })
@@ -1139,7 +1139,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-10.4",
     [[
-        SELECT '1' < 2.5;
+        SELECT '1' < 25e-1;
     ]], {
         1, "Type mismatch: can not convert double(2.5) to string"
     })
diff --git a/test/sql-tap/check.test.lua b/test/sql-tap/check.test.lua
index f8dcb7f7b..8fc1a0a45 100755
--- a/test/sql-tap/check.test.lua
+++ b/test/sql-tap/check.test.lua
@@ -207,7 +207,7 @@ test:do_execsql_test(
         CREATE TABLE t2(
           id  INT primary key,
           x SCALAR CONSTRAINT one CHECK( typeof(coalesce(x,0))=='integer'),
-          y DOUBLE CONSTRAINT two CHECK( typeof(coalesce(y,0.1))=='double' ),
+          y DOUBLE CONSTRAINT two CHECK( typeof(coalesce(y,1e-1))=='double' ),
           z SCALAR CONSTRAINT three CHECK( typeof(coalesce(z,''))=='string' )
         );
     ]], {
diff --git a/test/sql-tap/decimal.test.lua b/test/sql-tap/decimal.test.lua
index d422533d6..586913e8c 100755
--- a/test/sql-tap/decimal.test.lua
+++ b/test/sql-tap/decimal.test.lua
@@ -3,7 +3,7 @@ local build_path = os.getenv("BUILDDIR")
 package.cpath = build_path..'/test/sql-tap/?.so;'..build_path..'/test/sql-tap/?.dylib;'..package.cpath
 
 local test = require("sqltester")
-test:plan(104)
+test:plan(106)
 
 local dec = require("decimal")
 local dec1 = dec.new("111")
@@ -684,7 +684,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "dec-11.2.4",
     [[
-        INSERT INTO tsu VALUES ('4_double', 1.5);
+        INSERT INTO tsu VALUES ('4_double', 15e-1);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -819,7 +819,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "dec-14.1.3",
     [[
-        SELECT u - 0.5 FROM t2;
+        SELECT u - 5e-1 FROM t2;
     ]], {
         110.5, 3332.5, 55554.5
     })
@@ -835,7 +835,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "dec-14.1.5",
     [[
-        SELECT u / 1.0 FROM t2;
+        SELECT u / 1e0 FROM t2;
     ]], {
         111, 3333, 55555
     })
@@ -972,4 +972,24 @@ test:execsql([[
     DROP TABLE t1;
 ]])
 
+--
+-- gh-6356: Make sure that numeric literals with a decimal point and no exponent
+-- are treated as DECIMAL.
+--
+test:do_execsql_test(
+    "dec-17.1",
+    [[
+        SELECT 1.0, typeof(1.0);
+    ]], {
+        dec.new(1), 'decimal'
+    })
+
+test:do_test(
+    "dec-17.2",
+    function()
+        return box.execute([[SELECT 1.0;]]).metadata
+    end, {
+        {name = "COLUMN_1", type = "decimal"}
+    })
+
 test:finish_test()
diff --git a/test/sql-tap/default.test.lua b/test/sql-tap/default.test.lua
index 9c15220eb..039a1a92a 100755
--- a/test/sql-tap/default.test.lua
+++ b/test/sql-tap/default.test.lua
@@ -105,11 +105,11 @@ test:do_execsql_test(
 	b INT DEFAULT 12345 UNIQUE NOT NULL CHECK( b>=0 AND b<99999 ),
 	c VARCHAR(123) DEFAULT 'hello' NOT NULL,
 	d NUMBER,
-	e NUMBER DEFAULT 4.36,
+	e NUMBER DEFAULT 436e-2,
 	f VARCHAR(15), --COLLATE RTRIM,
 	g INTEGER DEFAULT( 3600*12 )
 	);
-	INSERT INTO t3 VALUES(null, 5, 'row1', 5.25, 8.67, '321', 432);
+	INSERT INTO t3 VALUES(null, 5, 'row1', 525e-2, 867e-2, '321', 432);
 	SELECT a, typeof(a), b, typeof(b), c, typeof(c),
 	d, typeof(d), e, typeof(e), f, typeof(f),
 	g, typeof(g) FROM t3;
diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
index 9f10994ae..f968afc50 100755
--- a/test/sql-tap/e_select1.test.lua
+++ b/test/sql-tap/e_select1.test.lua
@@ -327,7 +327,7 @@ test:do_execsql_test(
     "e_select-1.4.0",
     [[
         CREATE TABLE x1(id  INT primary key, a TEXT , b TEXT );
-        CREATE TABLE x2(id  INT primary key, c NUMBER , d NUMBER , e NUMBER );
+        CREATE TABLE x2(id  INT primary key, c DOUBLE, d DOUBLE, e DOUBLE);
         CREATE TABLE x3(id  INT primary key, f TEXT , g TEXT , h TEXT , i TEXT );
 
         -- x1: 3 rows, 2 columns
@@ -1482,8 +1482,8 @@ test:drop_all_tables()
 test:do_execsql_test(
     "e_select-7.4.0",
     [[
-        CREATE TABLE q1(id  INT primary key, a TEXT, b NUMBER, c NUMBER);
-        CREATE TABLE q2(id  INT primary key, d TEXT, e NUMBER);
+        CREATE TABLE q1(id  INT primary key, a TEXT, b DOUBLE, c DOUBLE);
+        CREATE TABLE q2(id  INT primary key, d TEXT, e DOUBLE);
         CREATE TABLE q3(id  INT primary key, f TEXT, g INT);
 
         INSERT INTO q1 VALUES(1, '16', -87.66, NULL);
@@ -1632,7 +1632,7 @@ test:drop_all_tables()
 test:do_execsql_test(
     "e_select-7.10.0",
     [[
-        CREATE TABLE w1(a TEXT PRIMARY KEY, b NUMBER);
+        CREATE TABLE w1(a TEXT PRIMARY KEY, b DOUBLE);
         CREATE TABLE w2(a  INT PRIMARY KEY, b TEXT);
 
         INSERT INTO w1 VALUES('1', 4.1);
@@ -1908,7 +1908,7 @@ test:do_select_tests(
 test:do_execsql_test(
     "e_select-8.8.0",
     [[
-        CREATE TABLE d3(id  INT primary key, a NUMBER);
+        CREATE TABLE d3(id  INT primary key, a DOUBLE);
         INSERT INTO d3 VALUES(1, 0);
         INSERT INTO d3 VALUES(2, 14.1);
         INSERT INTO d3 VALUES(3, 13);
@@ -2193,7 +2193,7 @@ for _, val in ipairs({
     {"1", "SELECT b FROM f1 ORDER BY a LIMIT 'hello' "},
     {"2", "SELECT b FROM f1 ORDER BY a LIMIT NULL "},
     {"3", "SELECT b FROM f1 ORDER BY a LIMIT X'ABCD' "},
-    {"4", "SELECT b FROM f1 ORDER BY a LIMIT 5.1 "},
+    {"4", "SELECT b FROM f1 ORDER BY a LIMIT 51e-1 "},
     {"5", "SELECT b FROM f1 ORDER BY a LIMIT (SELECT group_concat(b) FROM f1)"}}) do
     local tn = val[1]
     local select = val[2]
@@ -2248,7 +2248,7 @@ for _, val in ipairs({
     {1, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 'hello'"},
     {2, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET NULL"},
     {3, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET X'ABCD'"},
-    {4, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 5.1"},
+    {4, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET 51e-1"},
     {5, "SELECT b FROM f1 ORDER BY a LIMIT 2 OFFSET (SELECT group_concat(b) FROM f1)"}}) do
     local tn = val[1]
     local select = val[2]
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index 416f27d69..29e1c3de2 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -678,7 +678,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func-4.35",
     [[
-        SELECT round(1234567890123.445,2);
+        SELECT round(1234567890123.445e0,2);
     ]], {
         -- <func-4.35>
         1234567890123.45
@@ -708,7 +708,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func-4.38",
     [[
-        SELECT round(9999999999999.556,2);
+        SELECT round(9999999999999.556e0, 2);
     ]], {
         -- <func-4.38>
         9999999999999.56
@@ -1497,7 +1497,7 @@ test:do_execsql_test(
     "func-18.12",
     [[
         INSERT INTO t6 VALUES(3, 1<<62);
-        SELECT sum(x) - ((1<<62)*2.0+1) from t6;
+        SELECT sum(x) - ((1 << 62) * 2e0 + 1) from t6;
     ]], {
         -- <func-18.12>
         0
@@ -2817,7 +2817,7 @@ test:do_execsql_test("func-77.1", "SELECT TOSTRING('1');", {'1'})
 test:do_execsql_test("func-77.2", "SELECT TOSTRING('a');", {'a'})
 test:do_catchsql_test("func-77.3", "SELECT TOSTRING(1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got unsigned"})
 test:do_catchsql_test("func-77.4", "SELECT TOSTRING(-1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got integer"})
-test:do_catchsql_test("func-77.5", "SELECT TOSTRING(-1.1);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got double"})
+test:do_catchsql_test("func-77.5", "SELECT TOSTRING(-1.1e0);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got double"})
 test:do_catchsql_test("func-77.6", "SELECT TOSTRING(TRUE);", {1, "Function 'TOSTRING' returned value of invalid type: expected string got boolean"})
 test:do_execsql_test("func-77.7", "SELECT TOSTRING(NULL);", {""})
 test:do_execsql_test("func-77.8", "SELECT TOSTRING(LUA('return nil'));", {""})
@@ -2837,7 +2837,7 @@ test:do_catchsql_test("func-78.1", "SELECT TOUNSIGNED('1');", {1, "Function 'TOU
 test:do_catchsql_test("func-78.2", "SELECT TOUNSIGNED('a');", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got string"})
 test:do_execsql_test("func-78.3", "SELECT TOUNSIGNED(1);", {1})
 test:do_catchsql_test("func-78.4", "SELECT TOUNSIGNED(-1);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got integer"})
-test:do_catchsql_test("func-78.5", "SELECT TOUNSIGNED(-1.1);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got double"})
+test:do_catchsql_test("func-78.5", "SELECT TOUNSIGNED(-1.1e0);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got double"})
 test:do_catchsql_test("func-78.6", "SELECT TOUNSIGNED(TRUE);", {1, "Function 'TOUNSIGNED' returned value of invalid type: expected unsigned got boolean"})
 test:do_execsql_test("func-78.7", "SELECT TOUNSIGNED(NULL);", {""})
 test:do_execsql_test("func-78.8", "SELECT TOUNSIGNED(LUA('return nil'));", {""})
@@ -2857,7 +2857,7 @@ test:do_catchsql_test("func-79.1", "SELECT TOINTEGER('1');", {1, "Function 'TOIN
 test:do_catchsql_test("func-79.2", "SELECT TOINTEGER('a');", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got string"})
 test:do_execsql_test("func-79.3", "SELECT TOINTEGER(1);", {1})
 test:do_execsql_test("func-79.4", "SELECT TOINTEGER(-1);", {-1})
-test:do_catchsql_test("func-79.5", "SELECT TOINTEGER(-1.1);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got double"})
+test:do_catchsql_test("func-79.5", "SELECT TOINTEGER(-1.1e0);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got double"})
 test:do_catchsql_test("func-79.6", "SELECT TOINTEGER(TRUE);", {1, "Function 'TOINTEGER' returned value of invalid type: expected integer got boolean"})
 test:do_execsql_test("func-79.7", "SELECT TOINTEGER(NULL);", {""})
 test:do_execsql_test("func-79.8", "SELECT TOINTEGER(LUA('return nil'));", {""})
@@ -2877,7 +2877,7 @@ test:do_catchsql_test("func-80.1", "SELECT TONUMBER('1');", {1, "Function 'TONUM
 test:do_catchsql_test("func-80.2", "SELECT TONUMBER('a');", {1, "Function 'TONUMBER' returned value of invalid type: expected number got string"})
 test:do_execsql_test("func-80.3", "SELECT TONUMBER(1);", {1})
 test:do_execsql_test("func-80.4", "SELECT TONUMBER(-1);", {-1})
-test:do_execsql_test("func-80.5", "SELECT TONUMBER(-1.1);", {-1.1})
+test:do_execsql_test("func-80.5", "SELECT TONUMBER(-1.1e0);", {-1.1})
 test:do_catchsql_test("func-80.6", "SELECT TONUMBER(TRUE);", {1, "Function 'TONUMBER' returned value of invalid type: expected number got boolean"})
 test:do_execsql_test("func-80.7", "SELECT TONUMBER(NULL);", {""})
 test:do_execsql_test("func-80.8", "SELECT TONUMBER(LUA('return nil'));", {""})
@@ -2897,7 +2897,7 @@ test:do_catchsql_test("func-81.1", "SELECT TOBOOLEAN('1');", {1, "Function 'TOBO
 test:do_catchsql_test("func-81.2", "SELECT TOBOOLEAN('a');", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got string"})
 test:do_catchsql_test("func-81.3", "SELECT TOBOOLEAN(1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got unsigned"})
 test:do_catchsql_test("func-81.4", "SELECT TOBOOLEAN(-1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got integer"})
-test:do_catchsql_test("func-81.5", "SELECT TOBOOLEAN(-1.1);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got double"})
+test:do_catchsql_test("func-81.5", "SELECT TOBOOLEAN(-1.1e0);", {1, "Function 'TOBOOLEAN' returned value of invalid type: expected boolean got double"})
 test:do_execsql_test("func-81.6", "SELECT TOBOOLEAN(TRUE);", {true})
 test:do_execsql_test("func-81.7", "SELECT TOBOOLEAN(NULL);", {""})
 test:do_execsql_test("func-81.8", "SELECT TOBOOLEAN(LUA('return nil'));", {""})
@@ -2917,7 +2917,7 @@ test:do_execsql_test("func-82.1", "SELECT TOSCALAR('1');", {'1'})
 test:do_execsql_test("func-82.2", "SELECT TOSCALAR('a');", {'a'})
 test:do_execsql_test("func-82.3", "SELECT TOSCALAR(1);", {1})
 test:do_execsql_test("func-82.4", "SELECT TOSCALAR(-1);", {-1})
-test:do_execsql_test("func-82.5", "SELECT TOSCALAR(-1.1);", {-1.1})
+test:do_execsql_test("func-82.5", "SELECT TOSCALAR(-1.1e0);", {-1.1})
 test:do_execsql_test("func-82.6", "SELECT TOSCALAR(TRUE);", {true})
 test:do_execsql_test("func-82.7", "SELECT TOSCALAR(NULL);", {""})
 test:do_execsql_test("func-82.8", "SELECT TOSCALAR(LUA('return nil'));", {""})
diff --git a/test/sql-tap/func3.test.lua b/test/sql-tap/func3.test.lua
index 7f1d8d33c..549510360 100755
--- a/test/sql-tap/func3.test.lua
+++ b/test/sql-tap/func3.test.lua
@@ -28,7 +28,7 @@ test:plan(35)
 test:do_execsql_test(
     "func3-5.1",
     [[
-        SELECT likelihood(9223372036854775807, 0.5);
+        SELECT likelihood(9223372036854775807, 5e-1);
     ]], {
         -- <func3-5.1>
         9223372036854775807LL
@@ -38,7 +38,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.2",
     [[
-        SELECT likelihood(-9223372036854775808, 0.5);
+        SELECT likelihood(-9223372036854775808, 5e-1);
     ]], {
         -- <func3-5.2>
         -9223372036854775808LL
@@ -48,7 +48,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.3",
     [[
-        SELECT likelihood(14.125, 0.5);
+        SELECT likelihood(1.4125e1, 5e-1);
     ]], {
         -- <func3-5.3>
         14.125
@@ -58,7 +58,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.4",
     [[
-        SELECT likelihood(NULL, 0.5);
+        SELECT likelihood(NULL, 5e-1);
     ]], {
         -- <func3-5.4>
         ""
@@ -68,7 +68,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.5",
     [[
-        SELECT likelihood('test-string', 0.5);
+        SELECT likelihood('test-string', 5e-1);
     ]], {
         -- <func3-5.5>
         "test-string"
@@ -78,7 +78,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.6",
     [[
-        SELECT quote(likelihood(x'010203000405', 0.5));
+        SELECT quote(likelihood(x'010203000405', 5e-1));
     ]], {
         -- <func3-5.6>
         "X'010203000405'"
@@ -91,7 +91,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.7",
     [[
-        SELECT likelihood(123, 1.0), likelihood(456, 0.0);
+        SELECT likelihood(123, 1e0), likelihood(456, 0e0);
     ]], {
         -- <func3-5.7>
         123, 456
@@ -101,7 +101,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "func3-5.8",
     [[
-        SELECT likelihood(123, 1.000001);
+        SELECT likelihood(123, 1.000001e0);
     ]], {
         -- <func3-5.8>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -111,7 +111,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "func3-5.9",
     [[
-        SELECT likelihood(123, -0.000001);
+        SELECT likelihood(123, -1e-6);
     ]], {
         -- <func3-5.9>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -121,7 +121,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "func3-5.10",
     [[
-        SELECT likelihood(123, 0.5+0.3);
+        SELECT likelihood(123, 0.5 + 3e-1);
     ]], {
         -- <func3-5.10>
         1, "Illegal parameters, second argument to likelihood() must be a constant between 0.0 and 1.0"
@@ -135,7 +135,7 @@ test:do_catchsql_test(
 test:do_test(
     "func3-5.20",
     function()
-        return test:execsql "EXPLAIN SELECT likelihood(LEAST(1.0+'2.0',4*11), 0.5)"
+        return test:execsql "EXPLAIN SELECT likelihood(LEAST(1.0+'2.0',4*11), 5e-1)"
     end, test:execsql("EXPLAIN SELECT LEAST(1.0+'2.0',4*11)"))
 
 -- EVIDENCE-OF: R-11152-23456 The unlikely(X) function returns the
@@ -164,7 +164,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.32",
     [[
-        SELECT unlikely(14.125);
+        SELECT unlikely(1.4125e1);
     ]], {
         -- <func3-5.32>
         14.125
@@ -237,7 +237,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "func3-5.52",
     [[
-        SELECT likely(14.125);
+        SELECT likely(1.4125e1);
     ]], {
         -- <func3-5.52>
         14.125
diff --git a/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua b/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
index 37bf62487..2a6a60a81 100755
--- a/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
+++ b/test/sql-tap/gh-5364-define-bit-wise-rules.test.lua
@@ -25,7 +25,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-1.3",
     [[
-        SELECT 9 >> 2.0;
+        SELECT 9 >> 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -82,7 +82,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-2.3",
     [[
-        SELECT 9 << 2.0;
+        SELECT 9 << 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -139,7 +139,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-3.3",
     [[
-        SELECT 9 & 2.0;
+        SELECT 9 & 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
@@ -196,7 +196,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "gh-5364-4.3",
     [[
-        SELECT 9 | 2.0;
+        SELECT 9 | 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to unsigned"
     })
diff --git a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
index 390a2d9b2..bf636a261 100755
--- a/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
+++ b/test/sql-tap/gh-5756-implicit-cast-in-arithmetic.test.lua
@@ -25,7 +25,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-1.3",
     [[
-        SELECT 9 + 2.0;
+        SELECT 9 + 2e0;
     ]], {
         11
     })
@@ -82,7 +82,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-2.3",
     [[
-        SELECT 9 - 2.0;
+        SELECT 9 - 2e0;
     ]], {
         7
     })
@@ -139,7 +139,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-3.3",
     [[
-        SELECT 9 * 2.0;
+        SELECT 9 * 2e0;
     ]], {
         18
     })
@@ -196,7 +196,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "gh-5756-4.3",
     [[
-        SELECT 9 / 2.0;
+        SELECT 9 / 2e0;
     ]], {
         4.5
     })
@@ -253,7 +253,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "gh-5756-5.3",
     [[
-        SELECT 9 % 2.0;
+        SELECT 9 % 2e0;
     ]], {
         1, "Type mismatch: can not convert double(2.0) to integer"
     })
diff --git a/test/sql-tap/gh-6239-quote-with-double-arg.test.lua b/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
index dab12253e..2642d799b 100755
--- a/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
+++ b/test/sql-tap/gh-6239-quote-with-double-arg.test.lua
@@ -6,7 +6,7 @@ test:plan(1)
 test:do_execsql_test(
     "gh-6239",
     [[
-        SELECT QUOTE(1.5), TYPEOF(QUOTE(1.5));
+        SELECT QUOTE(1.5e0), TYPEOF(QUOTE(1.5e0));
     ]], {
         1.5, "double"
     })
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index 3230556d1..3879481df 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -598,7 +598,7 @@ end
 test:do_execsql_test(
     "index-12.1",
     [[
-        CREATE TABLE t4(id  INT primary key, a NUMBER,b INT );
+        CREATE TABLE t4(id INT primary key, a DOUBLE, b INT );
         INSERT INTO t4 VALUES(1, 0.0, 1);
         INSERT INTO t4 VALUES(2, 0.00, 2);
         INSERT INTO t4 VALUES(4, -1.0, 4);
diff --git a/test/sql-tap/insert3.test.lua b/test/sql-tap/insert3.test.lua
index 062fb1e33..3547122f0 100755
--- a/test/sql-tap/insert3.test.lua
+++ b/test/sql-tap/insert3.test.lua
@@ -236,7 +236,8 @@ test:do_execsql_test(
 test:do_execsql_test(
     "insert3-3.7",
     [[
-            CREATE TABLE t6(id INTEGER PRIMARY KEY AUTOINCREMENT, x INT ,y NUMBER DEFAULT 4.3, z TEXT DEFAULT 'hi');
+            CREATE TABLE t6(id INTEGER PRIMARY KEY AUTOINCREMENT, x INT,
+                            y DOUBLE DEFAULT 4.3, z TEXT DEFAULT 'hi');
             INSERT INTO t6 DEFAULT VALUES;
             SELECT * FROM t6;
     ]], {
diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
index 993417414..d2dd6b679 100755
--- a/test/sql-tap/lua_sql.test.lua
+++ b/test/sql-tap/lua_sql.test.lua
@@ -39,8 +39,8 @@ test:do_catchsql_test(
 for _, val in ipairs({
         {1, "'val'", "val"},
         {2, 1, 1},
-        {3, "1.0", 1},
-        {4, 1.5, 1.5},
+        {3, "1.0e0", 1},
+        {4, 1.5, require('decimal').new(1.5)},
     }) do
     local tn = val[1]
     local param = val[2]
diff --git a/test/sql-tap/metatypes.test.lua b/test/sql-tap/metatypes.test.lua
index 3e4091675..dfa5bbab4 100755
--- a/test/sql-tap/metatypes.test.lua
+++ b/test/sql-tap/metatypes.test.lua
@@ -14,7 +14,7 @@ test:do_execsql_test(
     "metatypes-1.1",
     [[
         INSERT INTO t VALUES(1, 1, 1);
-        INSERT INTO t VALUES(2, 2.0, 2.0);
+        INSERT INTO t VALUES(2, 2e0, 2e0);
         INSERT INTO t(i, s) VALUES(3, '3');
         INSERT INTO t(i, s) VALUES(4, true);
         INSERT INTO t(i, s) VALUES(5, x'35');
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 38eddfc64..771891380 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -217,7 +217,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.1",
     [[
-        SELECT .1
+        SELECT 1e-1
     ]], {
         -- <misc5-5.1>
         0.1
@@ -227,7 +227,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.2",
     [[
-        SELECT 2.
+        SELECT 2e0
     ]], {
         -- <misc5-5.2>
         2.0
diff --git a/test/sql-tap/numcast.test.lua b/test/sql-tap/numcast.test.lua
index 763708d76..62ea9e695 100755
--- a/test/sql-tap/numcast.test.lua
+++ b/test/sql-tap/numcast.test.lua
@@ -2,6 +2,8 @@
 local test = require("sqltester")
 test:plan(26)
 
+local dec = require('decimal')
+
 --!./tcltestrunner.lua
 -- 2013 March 20
 --
@@ -33,11 +35,11 @@ for _, enc in ipairs({"utf8"}) do
             return x
         end, enc)
     local data = {
-        {"1", "12345.0", 12345.0, 12345},
+        {"1", "12345.0", dec.new(12345.0), 12345},
         {"2", "12345.0e0", 12345.0, 12345},
         {"3", "-12345.0e0", -12345.0, -12345},
-        {"4", "-12345.25", -12345.25, -12345},
-        {"5", "-12345.0", -12345.0, -12345},
+        {"4", "-12345.25", dec.new(-12345.25), -12345},
+        {"5", "-12345.0", dec.new(-12345.0), -12345},
     }
     for _, val in ipairs(data) do
         local idx = val[1]
@@ -71,7 +73,7 @@ end
 test:do_execsql_test(
     "cast-2.1",
     [[
-        SELECT CAST((9223372036854775297.01) AS INTEGER);
+        SELECT CAST((9223372036854775297.01e0) AS INTEGER);
     ]], {
         9223372036854775808ULL
     })
@@ -79,7 +81,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.2",
     [[
-        SELECT CAST((18000000000000000000.) AS INTEGER);
+        SELECT CAST((18000000000000000000e0) AS INTEGER);
     ]], {
         18000000000000000000ULL
     })
@@ -87,7 +89,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.3",
     [[
-        SELECT CAST((9223372036854775297.01) AS UNSIGNED);
+        SELECT CAST((9223372036854775297.01e0) AS UNSIGNED);
     ]], {
         9223372036854775808ULL
     })
@@ -95,7 +97,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.4",
     [[
-        SELECT CAST((18000000000000000000.) AS UNSIGNED);
+        SELECT CAST((18000000000000000000e0) AS UNSIGNED);
     ]], {
         18000000000000000000ULL
     })
@@ -103,7 +105,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "cast-2.5",
     [[
-        SELECT CAST((20000000000000000000.) AS UNSIGNED);
+        SELECT CAST((20000000000000000000e0) AS UNSIGNED);
     ]], {
         1,"Type mismatch: can not convert double(2.0e+19) to unsigned"
     })
@@ -112,7 +114,7 @@ test:do_execsql_test(
     "cast-2.6",
     [[
         CREATE TABLE t (i INTEGER PRIMARY KEY);
-        INSERT INTO t VALUES(9223372036854775297.01);
+        INSERT INTO t VALUES(9223372036854775297.01e0);
         SELECT * FROM t;
     ]], {
         9223372036854775808ULL
@@ -121,7 +123,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "cast-2.7",
     [[
-        INSERT INTO t VALUES(18000000000000000000.01);
+        INSERT INTO t VALUES(18000000000000000000.01e0);
         SELECT * FROM t;
     ]], {
         9223372036854775808ULL,18000000000000000000ULL
@@ -130,7 +132,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "cast-2.8",
     [[
-        INSERT INTO t VALUES(20000000000000000000.01);
+        INSERT INTO t VALUES(20000000000000000000.01e0);
         SELECT * FROM t;
     ]], {
         1,"Type mismatch: can not convert double(2.0e+19) to integer"
@@ -139,7 +141,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "cast-2.9",
     [[
-        INSERT INTO t VALUES(2.1);
+        INSERT INTO t VALUES(2.1e0);
     ]], {
         1, "Type mismatch: can not convert double(2.1) to integer"
     })
@@ -147,7 +149,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "numcast-3.8",
     [[
-        SELECT (1 + 0) / 3, (1 + 0.) / 3, (1 + 0) / 3.;
+        SELECT (1 + 0) / 3, (1 + 0e0) / 3, (1 + 0) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -155,7 +157,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.9",
     [[
-        SELECT (1 - 0) / 3, (1 - 0.) / 3, (1 - 0) / 3.;
+        SELECT (1 - 0) / 3, (1 - 0e0) / 3, (1 - 0) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -163,7 +165,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.10",
     [[
-        SELECT (1 * 1) / 3, (1 * 1.) / 3, (1 * 1) / 3.;
+        SELECT (1 * 1) / 3, (1 * 1e0) / 3, (1 * 1) / 3e0;
     ]], {
         0, 0.33333333333333, 0.33333333333333
 })
@@ -171,7 +173,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "numcast-3.11",
     [[
-        SELECT (1 / 1) / 3, (1 / 1.) / 3, (1 / 1) / 3.;
+        SELECT (1 / 1) / 3, (1 / 1e0) / 3, (1 / 1) / 3e0;
     ]], {
         0 , 0.33333333333333, 0.33333333333333
 })
@@ -183,7 +185,7 @@ test:do_execsql_test(
 test:do_catchsql_test(
     "numcast-4",
     [[
-        SELECT CAST(-2.5 AS UNSIGNED);
+        SELECT CAST(-2.5e0 AS UNSIGNED);
     ]], {
         1, "Type mismatch: can not convert double(-2.5) to unsigned"
 })
@@ -195,7 +197,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "numcast-5",
     [[
-        SELECT CAST(-0.999 AS INTEGER), CAST(-0.111 AS UNSIGNED);
+        SELECT CAST(-0.999e0 AS INTEGER), CAST(-0.111e0 AS UNSIGNED);
     ]], {
         0, 0
 })
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index e89c7d2f8..131f75eab 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1157,7 +1157,7 @@ test:do_test(
     function()
         set_full_column_names(true)
         return test:execsql2 [[
-            SELECT 123.45;
+            SELECT 1.2345e2;
         ]]
     end, {
         -- <select1-6.9.5>
@@ -1481,7 +1481,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "select1-8.1",
     [[
-        SELECT f1 FROM test1 WHERE 4.3+2.4 OR 1 ORDER BY f1
+        SELECT f1 FROM test1 WHERE 4.3e0+2.4e0 OR 1 ORDER BY f1
     ]], {
         -- <select1-8.1>
         1, 'Type mismatch: can not convert double(6.7) to boolean'
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index 465800940..384641e08 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -759,7 +759,7 @@ test:do_test(
     "select4-8.1",
     function()
         test:execsql [[
-            CREATE TABLE t3(a text primary key, b NUMBER, c text);
+            CREATE TABLE t3(a text primary key, b DOUBLE, c text);
             START TRANSACTION;
             INSERT INTO t3 VALUES('1', 1.1, '1.1');
             INSERT INTO t3 VALUES('2', 1.10, '1.10');
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index 88f108f57..6c0b8e1ed 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -443,7 +443,7 @@ for ii = 3, 6, 1 do
             SELECT x, y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 JOIN t2 ON (c=d)
+              SELECT a*10 + 1e-1, f*10 + 1e-1 FROM t1 JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) ORDER BY 1;
@@ -457,7 +457,7 @@ for ii = 3, 6, 1 do
             SELECT x, y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 LEFT JOIN t2 ON (c=d)
+              SELECT a*10 + 1e-1, f*10 + 1e-1 FROM t1 LEFT JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) ORDER BY 1;
@@ -471,7 +471,7 @@ for ii = 3, 6, 1 do
             SELECT x+y FROM (
               SELECT a AS x, b AS y FROM t1
               UNION ALL
-              SELECT a*10 + 0.1, f*10 + 0.1 FROM t1 LEFT JOIN t2 ON (c=d)
+              SELECT a*10 + 1e-1, f*10 + 1e-1 FROM t1 LEFT JOIN t2 ON (c=d)
               UNION ALL
               SELECT a*100, b*100 FROM t1
             ) WHERE y+x IS NOT NULL ORDER BY 1;
diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
index 68a0ecbd2..d3f32bfb6 100755
--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -632,7 +632,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "sort-8.1",
     [[
-        CREATE TABLE t5(a NUMBER, b text PRIMARY KEY);
+        CREATE TABLE t5(a DOUBLE, b text PRIMARY KEY);
         INSERT INTO t5 VALUES(100,'A1');
         INSERT INTO t5 VALUES(100.0,'A2');
         SELECT * FROM t5 ORDER BY a, b;
diff --git a/test/sql-tap/tkt-9a8b09f8e6.test.lua b/test/sql-tap/tkt-9a8b09f8e6.test.lua
index cc321c2f6..983c8df2a 100755
--- a/test/sql-tap/tkt-9a8b09f8e6.test.lua
+++ b/test/sql-tap/tkt-9a8b09f8e6.test.lua
@@ -46,7 +46,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.3,
     [[
-        CREATE TABLE t3(x NUMBER primary key);
+        CREATE TABLE t3(x DOUBLE primary key);
         INSERT INTO t3 VALUES(1.0);
     ]], {
         -- <1.3>
@@ -57,7 +57,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.4,
     [[
-        CREATE TABLE t4(x NUMBER primary key);
+        CREATE TABLE t4(x DOUBLE primary key);
         INSERT INTO t4 VALUES(1.11);
     ]], {
         -- <1.4>
@@ -92,7 +92,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     2.2,
     [[
-        SELECT x FROM t1 WHERE x IN (1.0);
+        SELECT x FROM t1 WHERE x IN (1e0);
     ]], {
         -- <2.2>
         1, "Type mismatch: can not convert double(1.0) to string"
@@ -132,7 +132,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     2.6,
     [[
-        SELECT x FROM t1 WHERE 1.0 IN (x);
+        SELECT x FROM t1 WHERE 1e0 IN (x);
     ]], {
         -- <2.6>
         1, "Type mismatch: can not convert double(1.0) to string"
@@ -225,7 +225,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE x IN ('1');
     ]], {
         -- <4.3>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </4.3>
     })
 
@@ -235,7 +235,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE x IN ('1.0');
     ]], {
         -- <4.4>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </4.4>
     })
 
@@ -265,7 +265,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE '1' IN (x);
     ]], {
         -- <4.7>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </4.7>
     })
 
@@ -275,7 +275,7 @@ test:do_catchsql_test(
         SELECT x FROM t3 WHERE '1.0' IN (x);
     ]], {
         -- <4.8>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </4.8>
     })
 
@@ -305,7 +305,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1');
     ]], {
         -- <5.3>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </5.3>
     })
 
@@ -315,7 +315,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1.0');
     ]], {
         -- <5.4>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </5.4>
     })
 
@@ -335,7 +335,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE x IN ('1.11');
     ]], {
         -- <5.6>
-        1, "Type mismatch: can not convert string('1.11') to number"
+        1, "Type mismatch: can not convert string('1.11') to double"
         -- </5.6>
     })
 
@@ -365,7 +365,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1' IN (x);
     ]], {
         -- <5.9>
-        1, "Type mismatch: can not convert string('1') to number"
+        1, "Type mismatch: can not convert string('1') to double"
         -- </5.9>
     })
 
@@ -375,7 +375,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1.0' IN (x);
     ]], {
         -- <5.10>
-        1, "Type mismatch: can not convert string('1.0') to number"
+        1, "Type mismatch: can not convert string('1.0') to double"
         -- </5.10>
     })
 
@@ -395,7 +395,7 @@ test:do_catchsql_test(
         SELECT x FROM t4 WHERE '1.11' IN (x);
     ]], {
         -- <5.12>
-        1, "Type mismatch: can not convert string('1.11') to number"
+        1, "Type mismatch: can not convert string('1.11') to double"
         -- </5.12>
     })
 
diff --git a/test/sql-tap/tkt-a8a0d2996a.test.lua b/test/sql-tap/tkt-a8a0d2996a.test.lua
index a40621f41..37dc377a8 100755
--- a/test/sql-tap/tkt-a8a0d2996a.test.lua
+++ b/test/sql-tap/tkt-a8a0d2996a.test.lua
@@ -125,7 +125,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     4.0,
     [[
-        SELECT 1+1.;
+        SELECT 1+1e0;
     ]], {
         -- <4.0>
         2.0
diff --git a/test/sql-tap/types.test.lua b/test/sql-tap/types.test.lua
index 4e98e18b1..b86fb4db3 100755
--- a/test/sql-tap/types.test.lua
+++ b/test/sql-tap/types.test.lua
@@ -165,7 +165,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "types-2.2.1",
     [[
-        CREATE TABLE t2(id  INT primary key, a NUMBER);
+        CREATE TABLE t2(id  INT primary key, a DOUBLE);
         INSERT INTO t2 VALUES(1, 0.0);
         INSERT INTO t2 VALUES(2, 12345.678);
         INSERT INTO t2 VALUES(3, -12345.678);
diff --git a/test/sql-tap/uuid.test.lua b/test/sql-tap/uuid.test.lua
index fea9d9370..d5bef611f 100755
--- a/test/sql-tap/uuid.test.lua
+++ b/test/sql-tap/uuid.test.lua
@@ -339,7 +339,7 @@ test:do_catchsql_test(
 test:do_execsql_test(
     "uuid-6.1.15",
     [[
-        SELECT LIKELIHOOD(u, 0.5) from t2;
+        SELECT LIKELIHOOD(u, 5e-1) from t2;
     ]], {
         uuid1, uuid3, uuid2
     })
@@ -651,7 +651,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-7.2.4",
     [[
-        SELECT cast(1.5 AS UUID);
+        SELECT cast(1.5e0 AS UUID);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -804,7 +804,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-8.2.4",
     [[
-        INSERT INTO tsu VALUES ('4_double', 1.5);
+        INSERT INTO tsu VALUES ('4_double', 1.5e0);
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -1098,7 +1098,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-13.1.4",
     [[
-        SELECT u > 1.5 FROM t2;
+        SELECT u > 1.5e0 FROM t2;
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
@@ -1162,7 +1162,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "uuid-13.2.4",
     [[
-        SELECT u = 1.5 FROM t2;
+        SELECT u = 1.5e0 FROM t2;
     ]], {
         1, "Type mismatch: can not convert double(1.5) to uuid"
     })
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index 58e5d3e0b..2c424454d 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -23,7 +23,7 @@ test:do_test(
     "whereA-1.1",
     function()
         return test:execsql [[
-            CREATE TABLE t1(a INTEGER PRIMARY KEY, b NUMBER UNIQUE, c TEXT);
+            CREATE TABLE t1(a INTEGER PRIMARY KEY, b DOUBLE UNIQUE, c TEXT);
             INSERT INTO t1 VALUES(1,2,'3');
             INSERT INTO t1 values(2,55,'world');
             INSERT INTO t1 VALUES(3,4.53,NULL);
diff --git a/test/sql-tap/whereG.test.lua b/test/sql-tap/whereG.test.lua
index 49501a4a5..1996b007f 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -103,7 +103,7 @@ test:do_eqp_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', 0.5)
+         WHERE likelihood(cname LIKE '%bach%', 5e-1)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -117,7 +117,7 @@ test:do_execsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%' COLLATE "unicode_ci", 0.5)
+         WHERE likelihood(cname LIKE '%bach%' COLLATE "unicode_ci", 5e-1)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -187,7 +187,7 @@ test:do_catchsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', -0.01)
+         WHERE likelihood(cname LIKE '%bach%', -1e-1)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -201,7 +201,7 @@ test:do_catchsql_test(
     [[
         SELECT DISTINCT aname
           FROM album, composer, track
-         WHERE likelihood(cname LIKE '%bach%', 1.01)
+         WHERE likelihood(cname LIKE '%bach%', 1.01e0)
            AND composer.cid=track.cid
            AND album.aid=track.aid;
     ]], {
@@ -370,7 +370,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "7.2",
     [[
-        SELECT likelihood(a,0.5), x FROM t1, t2 ORDER BY 1, 2;
+        SELECT likelihood(a,5e-1), x FROM t1, t2 ORDER BY 1, 2;
     ]], {
         -- <7.2>
         1, 3, 1, 4, 9, 3, 9, 4
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 761004b23..44d5a954e 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -534,10 +534,10 @@ test:do_catchsql_test(7.6, [[
 --
 test:do_execsql_test("8.1-mandelbrot", [[
   WITH RECURSIVE
-    xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2),
-    yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0),
+    xaxis(x) AS (VALUES(-2e0) UNION ALL SELECT x+5e-2 FROM xaxis WHERE x<1.2e0),
+    yaxis(y) AS (VALUES(-1e0) UNION ALL SELECT y+1e-1 FROM yaxis WHERE y<1.0e0),
     m(iter, cx, cy, x, y) AS (
-      SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis
+      SELECT 0, x, y, 0e0, 0e0 FROM xaxis, yaxis
       UNION ALL
       SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m
        WHERE (x*x + y*y) < 4.0 AND iter<28
diff --git a/test/sql/boolean.result b/test/sql/boolean.result
index 75a091cce..984529f64 100644
--- a/test/sql/boolean.result
+++ b/test/sql/boolean.result
@@ -546,12 +546,12 @@ SELECT cast(0 AS BOOLEAN);
 SELECT cast(0.123 AS BOOLEAN);
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.123) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.123) to boolean'
  | ...
 SELECT cast(0.0 AS BOOLEAN);
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.0) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.0) to boolean'
  | ...
 SELECT cast('true' AS BOOLEAN), cast('false' AS BOOLEAN);
  | ---
@@ -3920,7 +3920,7 @@ INSERT INTO t8 VALUES (4.56);
 SELECT true AND 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false AND 2.3;
  | ---
@@ -3933,17 +3933,17 @@ SELECT false AND 2.3;
 SELECT true OR 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false OR 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 AND true;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 AND false;
  | ---
@@ -3956,53 +3956,53 @@ SELECT 2.3 AND false;
 SELECT 2.3 OR true;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 OR false;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 
 SELECT a1, a1 AND 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 OR 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 AND a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 OR a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 AND 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 OR 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 AND a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 OR a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 
 SELECT c, true AND c FROM t8;
@@ -4140,12 +4140,12 @@ SELECT false / 2.3;
 SELECT true % 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT false % 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT 2.3 + true;
  | ---
@@ -4221,7 +4221,7 @@ SELECT a1, a1 / 2.3 FROM t6
 SELECT a1, a1 % 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT a1, 2.3 + a1 FROM t6
  | ---
@@ -4271,7 +4271,7 @@ SELECT a2, a2 / 2.3 FROM t6
 SELECT a2, a2 % 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to integer'
+ | - 'Type mismatch: can not convert decimal(2.3) to integer'
  | ...
 SELECT a2, 2.3 + a2 FROM t6
  | ---
@@ -4504,22 +4504,22 @@ SELECT a2, c, c % a2 FROM t6, t8;
 SELECT true > 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false > 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true < 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false < 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 > true;
  | ---
@@ -4545,12 +4545,12 @@ SELECT 2.3 < false;
 SELECT a1, a1 > 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 < 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 > a1 FROM t6
  | ---
@@ -4565,12 +4565,12 @@ SELECT a1, 2.3 < a1 FROM t6
 SELECT a2, a2 > 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 < 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 > a2 FROM t6
  | ---
@@ -4668,22 +4668,22 @@ SELECT a2, c, c < a2 FROM t6, t8;
 SELECT true >= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false >= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true <= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false <= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 >= true;
  | ---
@@ -4709,12 +4709,12 @@ SELECT 2.3 <= false;
 SELECT a1, a1 >= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 <= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 >= a1 FROM t6
  | ---
@@ -4729,12 +4729,12 @@ SELECT a1, 2.3 <= a1 FROM t6
 SELECT a2, a2 >= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 <= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 >= a2 FROM t6
  | ---
@@ -4832,22 +4832,22 @@ SELECT a2, c, c <= a2 FROM t6, t8;
 SELECT true == 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false == 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT true != 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT false != 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT 2.3 == true;
  | ---
@@ -4873,12 +4873,12 @@ SELECT 2.3 != false;
 SELECT a1, a1 == 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, a1 != 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a1, 2.3 == a1 FROM t6
  | ---
@@ -4893,12 +4893,12 @@ SELECT a1, 2.3 != a1 FROM t6
 SELECT a2, a2 == 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, a2 != 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert double(2.3) to boolean'
+ | - 'Type mismatch: can not convert decimal(2.3) to boolean'
  | ...
 SELECT a2, 2.3 == a2 FROM t6
  | ---
@@ -5049,22 +5049,22 @@ SELECT a2 IN (SELECT c FROM t8) FROM t6 LIMIT 1;
 SELECT true BETWEEN 0.1 and 9.9;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT false BETWEEN 0.1 and 9.9;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT a1, a1 BETWEEN 0.1 and 9.9 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 SELECT a2, a2 BETWEEN 0.1 and 9.9 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert double(0.1) to boolean'
+ | - 'Type mismatch: can not convert decimal(0.1) to boolean'
  | ...
 
 -- Check interaction of BOOLEAN and TEXT.
diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
index 5fd2b79c0..c890de7a3 100644
--- a/test/sql/func-recreate.result
+++ b/test/sql/func-recreate.result
@@ -25,7 +25,7 @@ test_run:cmd("setopt delimiter ''");
 ch = fiber.channel(1)
 ---
 ...
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2)')) end)
+_ = fiber.create(function () ch:put(box.execute('select WAITFOR(2e-1)')) end)
 ---
 ...
 fiber.sleep(0.1)
diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
index b76789f86..a281637c3 100644
--- a/test/sql/func-recreate.test.lua
+++ b/test/sql/func-recreate.test.lua
@@ -13,7 +13,7 @@ test_run:cmd("setopt delimiter ''");
 
 ch = fiber.channel(1)
 
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2)')) end)
+_ = fiber.create(function () ch:put(box.execute('select WAITFOR(2e-1)')) end)
 fiber.sleep(0.1)
 
 box.func.WAITFOR:drop()
diff --git a/test/sql/gh-3888-values-blob-assert.result b/test/sql/gh-3888-values-blob-assert.result
index 669f2eb2f..ce3f58cdc 100644
--- a/test/sql/gh-3888-values-blob-assert.result
+++ b/test/sql/gh-3888-values-blob-assert.result
@@ -69,7 +69,7 @@ box.execute('SELECT 3.14')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [3.14]
 ...
diff --git a/test/sql/integer-overflow.result b/test/sql/integer-overflow.result
index 8cad30ef3..91958d4e9 100644
--- a/test/sql/integer-overflow.result
+++ b/test/sql/integer-overflow.result
@@ -114,7 +114,7 @@ box.execute('SELECT CAST(\'18446744073709551616\' AS INTEGER);')
 -- float 18446744073709551600 -> int (18446744073709551616),
 -- with error due to conversion = 16.
 --
-box.execute('SELECT CAST(18446744073709551600. AS INTEGER);')
+box.execute('SELECT CAST(18446744073709551600e0 AS INTEGER);')
 ---
 - null
 - 'Type mismatch: can not convert double(1.84467440737096e+19) to integer'
diff --git a/test/sql/integer-overflow.test.lua b/test/sql/integer-overflow.test.lua
index 2ac97995a..5a9ebca19 100644
--- a/test/sql/integer-overflow.test.lua
+++ b/test/sql/integer-overflow.test.lua
@@ -32,7 +32,7 @@ box.execute('SELECT CAST(\'18446744073709551616\' AS INTEGER);')
 -- float 18446744073709551600 -> int (18446744073709551616),
 -- with error due to conversion = 16.
 --
-box.execute('SELECT CAST(18446744073709551600. AS INTEGER);')
+box.execute('SELECT CAST(18446744073709551600e0 AS INTEGER);')
 -- gh-3810: make sure that if space contains integers in range
 -- [INT64_MAX, UINT64_MAX], they are handled inside SQL in a
 -- proper way, which now means that an error is raised.
diff --git a/test/sql/misc.result b/test/sql/misc.result
index 91464ec33..c3c0b161b 100644
--- a/test/sql/misc.result
+++ b/test/sql/misc.result
@@ -87,12 +87,28 @@ box.execute('SELECT 1.5;')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [1.5]
 ...
 box.execute('SELECT 1.0;')
 ---
+- metadata:
+  - name: COLUMN_1
+    type: decimal
+  rows:
+  - [1.0]
+...
+box.execute('SELECT 1.5e0;')
+---
+- metadata:
+  - name: COLUMN_1
+    type: double
+  rows:
+  - [1.5]
+...
+box.execute('SELECT 1e0;')
+---
 - metadata:
   - name: COLUMN_1
     type: double
diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
index 8de7366b1..8b34d1071 100644
--- a/test/sql/misc.test.lua
+++ b/test/sql/misc.test.lua
@@ -24,6 +24,8 @@ box.execute('CREATE TABLE test (id INTEGER PRIMARY KEY, b TEXT CONSTRAINT c1 COL
 box.execute('SELECT 1;')
 box.execute('SELECT 1.5;')
 box.execute('SELECT 1.0;')
+box.execute('SELECT 1.5e0;')
+box.execute('SELECT 1e0;')
 box.execute('SELECT \'abc\';')
 box.execute('SELECT X\'4D6564766564\'')
 
diff --git a/test/sql/types.result b/test/sql/types.result
index b8e0d1fcb..947795b03 100644
--- a/test/sql/types.result
+++ b/test/sql/types.result
@@ -163,7 +163,7 @@ box.execute("SELECT 'abc' || 1;")
 box.execute("SELECT 'abc' || 1.123;")
 ---
 - null
-- 'Inconsistent types: expected string or varbinary got double(1.123)'
+- 'Inconsistent types: expected string or varbinary got decimal(1.123)'
 ...
 box.execute("SELECT 1 || 'abc';")
 ---
@@ -173,7 +173,7 @@ box.execute("SELECT 1 || 'abc';")
 box.execute("SELECT 1.123 || 'abc';")
 ---
 - null
-- 'Inconsistent types: expected string or varbinary got double(1.123)'
+- 'Inconsistent types: expected string or varbinary got decimal(1.123)'
 ...
 box.execute("SELECt 'a' || 'b' || 1;")
 ---
@@ -298,7 +298,7 @@ box.execute('SELECT 1 + 1.1;')
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [2.1]
 ...
@@ -346,7 +346,7 @@ box.execute("SELECT * FROM tboolean WHERE s1 = 1;")
 box.execute("SELECT * FROM tboolean WHERE s1 = 1.123;")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to boolean'
+- 'Type mismatch: can not convert decimal(1.123) to boolean'
 ...
 box.space.TBOOLEAN:drop()
 ---
@@ -463,7 +463,8 @@ box.execute("SELECT a FROM t1 WHERE a IN (1.1, 2.1);")
 - metadata:
   - name: A
     type: unsigned
-  rows: []
+  rows:
+  - [1]
 ...
 s:drop()
 ---
@@ -582,7 +583,7 @@ box.execute("SELECT 18446744073709551615 = null;")
   rows:
   - [null]
 ...
-box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
+box.execute("SELECT 18446744073709551615 = 18446744073709551615e0;")
 ---
 - metadata:
   - name: COLUMN_1
@@ -590,7 +591,7 @@ box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
   rows:
   - [false]
 ...
-box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
+box.execute("SELECT 18446744073709551615e0 > 18446744073709551615")
 ---
 - metadata:
   - name: COLUMN_1
@@ -598,7 +599,7 @@ box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
   rows:
   - [true]
 ...
-box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615.0)")
+box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615e0)")
 ---
 - null
 - 'Type mismatch: can not convert integer(18446744073709551615) to string'
@@ -1075,7 +1076,7 @@ box.execute("SELECT CAST(1.5 AS UNSIGNED);")
 box.execute("SELECT CAST(-1.5 AS UNSIGNED);")
 ---
 - null
-- 'Type mismatch: can not convert double(-1.5) to unsigned'
+- 'Type mismatch: can not convert decimal(-1.5) to unsigned'
 ...
 box.execute("SELECT CAST(true AS UNSIGNED);")
 ---
@@ -1192,7 +1193,7 @@ box.execute("INSERT INTO t VALUES(1, 1);")
 box.execute("INSERT INTO t VALUES(1, 1.123);")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("INSERT INTO t VALUES(1, true);")
 ---
@@ -1216,7 +1217,7 @@ box.execute("SELECT * FROM t WHERE v = 1")
 box.execute("SELECT * FROM t WHERE v = 1.123")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("SELECT * FROM t WHERE v = 'str'")
 ---
@@ -1424,7 +1425,7 @@ box.execute("SELECT CAST(1 AS VARBINARY);")
 box.execute("SELECT CAST(1.123 AS VARBINARY);")
 ---
 - null
-- 'Type mismatch: can not convert double(1.123) to varbinary'
+- 'Type mismatch: can not convert decimal(1.123) to varbinary'
 ...
 box.execute("SELECT CAST(true AS VARBINARY);")
 ---
@@ -1657,15 +1658,15 @@ box.execute("SELECT 1.0;")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
-  - [1]
+  - [1.0]
 ...
 box.execute("SELECT .01;")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   rows:
   - [0.01]
 ...
@@ -2031,11 +2032,11 @@ box.execute("SELECT 1.0, typeof(1.0);")
 ---
 - metadata:
   - name: COLUMN_1
-    type: double
+    type: decimal
   - name: COLUMN_2
     type: string
   rows:
-  - [1, 'double']
+  - [1.0, 'decimal']
 ...
 box.execute("SELECT CAST(2 AS DOUBLE), typeof(CAST(2 AS DOUBLE));")
 ---
@@ -2146,7 +2147,7 @@ box.execute([[INSERT INTO ti(i) VALUES (11);]])
   - 2
   row_count: 1
 ...
-box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1);]])
+box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1e0);]])
 ---
 - null
 - 'Type mismatch: can not convert double(1.0e+32) to integer'
@@ -2248,7 +2249,7 @@ box.execute([[INSERT INTO tb(b) VALUES (11);]])
 box.execute([[INSERT INTO tb(b) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to boolean'
+- 'Type mismatch: can not convert decimal(22.2) to boolean'
 ...
 box.execute([[INSERT INTO tb(b) VALUES (true);]])
 ---
@@ -2291,7 +2292,7 @@ box.execute([[INSERT INTO tt(t) VALUES (11);]])
 box.execute([[INSERT INTO tt(t) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to string'
+- 'Type mismatch: can not convert decimal(22.2) to string'
 ...
 box.execute([[INSERT INTO tt(t) VALUES (true);]])
 ---
@@ -2334,7 +2335,7 @@ box.execute([[INSERT INTO tv(v) VALUES (11);]])
 box.execute([[INSERT INTO tv(v) VALUES (22.2);]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to varbinary'
+- 'Type mismatch: can not convert decimal(22.2) to varbinary'
 ...
 box.execute([[INSERT INTO tv(v) VALUES (true);]])
 ---
@@ -2501,7 +2502,7 @@ box.execute([[UPDATE ti SET i = 11 WHERE a = 1;]])
 ---
 - row_count: 1
 ...
-box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1 WHERE a = 1;]])
+box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1e0 WHERE a = 1;]])
 ---
 - null
 - 'Type mismatch: can not convert double(1.0e+32) to integer'
@@ -2589,7 +2590,7 @@ box.execute([[UPDATE tb SET b = 11 WHERE a = 1;]])
 box.execute([[UPDATE tb SET b = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to boolean'
+- 'Type mismatch: can not convert decimal(22.2) to boolean'
 ...
 box.execute([[UPDATE tb SET b = true WHERE a = 1;]])
 ---
@@ -2627,7 +2628,7 @@ box.execute([[UPDATE tt SET t = 11 WHERE a = 1;]])
 box.execute([[UPDATE tt SET t = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to string'
+- 'Type mismatch: can not convert decimal(22.2) to string'
 ...
 box.execute([[UPDATE tt SET t = true WHERE a = 1;]])
 ---
@@ -2665,7 +2666,7 @@ box.execute([[UPDATE tv SET v = 11 WHERE a = 1;]])
 box.execute([[UPDATE tv SET v = 22.2 WHERE a = 1;]])
 ---
 - null
-- 'Type mismatch: can not convert double(22.2) to varbinary'
+- 'Type mismatch: can not convert decimal(22.2) to varbinary'
 ...
 box.execute([[UPDATE tv SET v = true WHERE a = 1;]])
 ---
diff --git a/test/sql/types.test.lua b/test/sql/types.test.lua
index 0270d9f8a..e9b5012af 100644
--- a/test/sql/types.test.lua
+++ b/test/sql/types.test.lua
@@ -149,9 +149,9 @@ box.execute("SELECT -1 < 18446744073709551615;")
 box.execute("SELECT -1 > 18446744073709551615;")
 box.execute("SELECT 18446744073709551610 - 18446744073709551615;")
 box.execute("SELECT 18446744073709551615 = null;")
-box.execute("SELECT 18446744073709551615 = 18446744073709551615.0;")
-box.execute("SELECT 18446744073709551615.0 > 18446744073709551615")
-box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615.0)")
+box.execute("SELECT 18446744073709551615 = 18446744073709551615e0;")
+box.execute("SELECT 18446744073709551615e0 > 18446744073709551615")
+box.execute("SELECT 18446744073709551615 IN ('18446744073709551615', 18446744073709551615e0)")
 box.execute("SELECT 1 LIMIT 18446744073709551615;")
 box.execute("SELECT 1 LIMIT 1 OFFSET 18446744073709551614;")
 box.execute("SELECT CAST('18446744073' || '709551616' AS INTEGER);")
@@ -504,7 +504,7 @@ box.execute([[CREATE TABLE ts (a INT PRIMARY KEY AUTOINCREMENT, s SCALAR);]])
 
 box.execute([[INSERT INTO ti(i) VALUES (NULL);]])
 box.execute([[INSERT INTO ti(i) VALUES (11);]])
-box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1);]])
+box.execute([[INSERT INTO ti(i) VALUES (100000000000000000000000000000000.1e0);]])
 box.execute([[INSERT INTO ti(i) VALUES (33.0);]])
 box.execute([[INSERT INTO ti(i) VALUES (true);]])
 box.execute([[INSERT INTO ti(i) VALUES ('33');]])
@@ -569,7 +569,7 @@ box.execute([[SELECT * FROM ti, td, tb, tt, tv, ts;]])
 
 box.execute([[UPDATE ti SET i = NULL WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = 11 WHERE a = 1;]])
-box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1 WHERE a = 1;]])
+box.execute([[UPDATE ti SET i = 100000000000000000000000000000000.1e0 WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = 33.0 WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = true WHERE a = 1;]])
 box.execute([[UPDATE ti SET i = '33' WHERE a = 1;]])
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-03  9:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 10:27 [Tarantool-patches] [PATCH v1 1/1] sql: introduce literals for DECIMAL Mergen Imeev via Tarantool-patches
2021-11-03  9:55 ` Kirill Yukhin via Tarantool-patches
  -- strict thread matches above, loose matches on Subject: below --
2021-10-04 13:35 Mergen Imeev via Tarantool-patches
2021-10-08 22:32 ` Vladislav Shpilevoy via Tarantool-patches
2021-10-19  8:49   ` Mergen Imeev via Tarantool-patches
2021-10-24 15:50     ` Vladislav Shpilevoy via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox