Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper
@ 2019-10-27 21:35 Vladislav Shpilevoy
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 1/3] sql: LENGTH function accepts boolean Vladislav Shpilevoy
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Vladislav Shpilevoy @ 2019-10-27 21:35 UTC (permalink / raw)
  To: tarantool-patches, korablev; +Cc: tarantool-patches

The patchset contains 3 independent commits fixing some minor
things in SQL.

The commit messages below speak for themselves, everything is
trivial.

This patchset is mostly about problems mentioned in #4462, but
does not close it. Because I don't know to fix the last problem
yet, and don't know whether I will do it.

Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-4462-sql-boolean-bugs
Issue: https://github.com/tarantool/tarantool/issues/4462

Vladislav Shpilevoy (3):
  sql: LENGTH function accepts boolean
  sql: CAST(<boolean> AS TEXT) returns lowercase
  sql: make type string case lower everywhere

 src/box/sql/delete.c             |   2 +-
 src/box/sql/func.c               |  12 +-
 src/box/sql/insert.c             |   2 +-
 src/box/sql/pragma.c             |   4 +-
 src/box/sql/pragma.h             |  92 +++---
 src/box/sql/prepare.c            |  24 +-
 src/box/sql/update.c             |   2 +-
 src/box/sql/vdbe.c               |  16 +-
 src/box/sql/vdbeapi.c            |  16 +-
 src/box/sql/vdbemem.c            |   2 +-
 test/sql-tap/func.test.lua       |   2 +-
 test/sql-tap/position.test.lua   |  16 +-
 test/sql-tap/sql-errors.test.lua |   4 +-
 test/sql/boolean.result          | 526 ++++++++++++++++---------------
 test/sql/boolean.test.sql        |   2 +
 test/sql/iproto.result           |  48 +--
 test/sql/row-count.result        |  10 +-
 test/sql/sql-debug.result        |   6 +-
 test/sql/types.result            |  42 +--
 19 files changed, 417 insertions(+), 411 deletions(-)

-- 
2.21.0 (Apple Git-122)

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

* [Tarantool-patches] [PATCH 1/3] sql: LENGTH function accepts boolean
  2019-10-27 21:35 [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Vladislav Shpilevoy
@ 2019-10-27 21:35 ` Vladislav Shpilevoy
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase Vladislav Shpilevoy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Vladislav Shpilevoy @ 2019-10-27 21:35 UTC (permalink / raw)
  To: tarantool-patches, korablev; +Cc: tarantool-patches

Before the patch LENGTH didn't take boolean argument
into account. Now it does and treats like any other
non-string argument - stringify and calculate length.

It is worth mentioning, that in future LENGTH will
discard any non-string argument, see #3929.

Part of #4462
---
 src/box/sql/func.c        | 1 +
 test/sql/boolean.result   | 5 +++--
 test/sql/boolean.test.sql | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/box/sql/func.c b/src/box/sql/func.c
index d5ea0fe6a..12a4bee04 100644
--- a/src/box/sql/func.c
+++ b/src/box/sql/func.c
@@ -458,6 +458,7 @@ lengthFunc(sql_context * context, int argc, sql_value ** argv)
 	case MP_BIN:
 	case MP_INT:
 	case MP_UINT:
+	case MP_BOOL:
 	case MP_DOUBLE:{
 			sql_result_uint(context, sql_value_bytes(argv[0]));
 			break;
diff --git a/test/sql/boolean.result b/test/sql/boolean.result
index 352649136..ac9f7fcaf 100644
--- a/test/sql/boolean.result
+++ b/test/sql/boolean.result
@@ -311,14 +311,15 @@ SELECT quote(a) FROM t0;
  |   - ['NULL']
  |   - ['NULL']
  | ...
+-- gh-4462: LENGTH didn't take BOOLEAN arguments.
 SELECT length(a) FROM t0;
  | ---
  | - metadata:
  |   - name: length(a)
  |     type: integer
  |   rows:
- |   - [null]
- |   - [null]
+ |   - [5]
+ |   - [4]
  |   - [null]
  |   - [null]
  | ...
diff --git a/test/sql/boolean.test.sql b/test/sql/boolean.test.sql
index 9d71139fd..68a05852f 100644
--- a/test/sql/boolean.test.sql
+++ b/test/sql/boolean.test.sql
@@ -82,6 +82,7 @@ SELECT abs(a) FROM t0;
 SELECT lower(a) FROM t0;
 SELECT upper(a) FROM t0;
 SELECT quote(a) FROM t0;
+-- gh-4462: LENGTH didn't take BOOLEAN arguments.
 SELECT length(a) FROM t0;
 SELECT typeof(a) FROM t0;
 
-- 
2.21.0 (Apple Git-122)

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

* [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase
  2019-10-27 21:35 [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Vladislav Shpilevoy
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 1/3] sql: LENGTH function accepts boolean Vladislav Shpilevoy
@ 2019-10-27 21:35 ` Vladislav Shpilevoy
  2019-10-28 14:08   ` Nikita Pettik
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere Vladislav Shpilevoy
  2019-10-30 23:28 ` [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Nikita Pettik
  3 siblings, 1 reply; 10+ messages in thread
From: Vladislav Shpilevoy @ 2019-10-27 21:35 UTC (permalink / raw)
  To: tarantool-patches, korablev; +Cc: tarantool-patches

Implicit cast uses lowercase, and the patch makes the
explicit cast the same.

No any special reason behind that. Lower case is
already used much more often, so it is easier to drop
the upper case.

Part of #4462
---
 src/box/sql/vdbemem.c     | 2 +-
 test/sql/boolean.result   | 3 ++-
 test/sql/boolean.test.sql | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c
index dcfc59820..6964c9097 100644
--- a/src/box/sql/vdbemem.c
+++ b/src/box/sql/vdbemem.c
@@ -753,7 +753,7 @@ sqlVdbeMemCast(Mem * pMem, enum field_type type)
 		assert(type == FIELD_TYPE_STRING);
 		assert(MEM_Str == (MEM_Blob >> 3));
 		if ((pMem->flags & MEM_Bool) != 0) {
-			const char *str_bool = pMem->u.b ? "TRUE" : "FALSE";
+			const char *str_bool = pMem->u.b ? "true" : "false";
 			sqlVdbeMemSetStr(pMem, str_bool, strlen(str_bool), 1,
 					 SQL_TRANSIENT);
 			return 0;
diff --git a/test/sql/boolean.result b/test/sql/boolean.result
index ac9f7fcaf..191fa33f3 100644
--- a/test/sql/boolean.result
+++ b/test/sql/boolean.result
@@ -513,6 +513,7 @@ SELECT cast(true AS NUMBER), cast(false AS NUMBER);
  | - null
  | - 'Type mismatch: can not convert true to number'
  | ...
+-- gh-4462: ensure that text representation is lowercase.
 SELECT cast(true AS TEXT), cast(false AS TEXT);
  | ---
  | - metadata:
@@ -521,7 +522,7 @@ SELECT cast(true AS TEXT), cast(false AS TEXT);
  |   - name: cast(false AS TEXT)
  |     type: string
  |   rows:
- |   - ['TRUE', 'FALSE']
+ |   - ['true', 'false']
  | ...
 SELECT cast(true AS BOOLEAN), cast(false AS BOOLEAN);
  | ---
diff --git a/test/sql/boolean.test.sql b/test/sql/boolean.test.sql
index 68a05852f..63eb505c5 100644
--- a/test/sql/boolean.test.sql
+++ b/test/sql/boolean.test.sql
@@ -129,6 +129,7 @@ INSERT INTO t3 VALUES (4, false)
 -- Check CAST from BOOLEAN to the other types.
 SELECT cast(true AS INTEGER), cast(false AS INTEGER);
 SELECT cast(true AS NUMBER), cast(false AS NUMBER);
+-- gh-4462: ensure that text representation is lowercase.
 SELECT cast(true AS TEXT), cast(false AS TEXT);
 SELECT cast(true AS BOOLEAN), cast(false AS BOOLEAN);
 
-- 
2.21.0 (Apple Git-122)

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

* [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere
  2019-10-27 21:35 [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Vladislav Shpilevoy
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 1/3] sql: LENGTH function accepts boolean Vladislav Shpilevoy
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase Vladislav Shpilevoy
@ 2019-10-27 21:35 ` Vladislav Shpilevoy
  2019-10-28 14:23   ` Nikita Pettik
  2019-10-30 23:28 ` [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Nikita Pettik
  3 siblings, 1 reply; 10+ messages in thread
From: Vladislav Shpilevoy @ 2019-10-27 21:35 UTC (permalink / raw)
  To: tarantool-patches, korablev; +Cc: tarantool-patches

Type was displayed in error messages, was returned in
meta headers, and a type string is a result of
typeof() SQL function.

Typeof() always returns lower case type string; meta
contained upper case type; error messages contained
both.

It was necessary to choose one case for everything,
and the lower one was chosen. It allows not to break
typeof() function which actually might be used by
someone.

Part of #4462
---
 src/box/sql/delete.c             |   2 +-
 src/box/sql/func.c               |  11 +-
 src/box/sql/insert.c             |   2 +-
 src/box/sql/pragma.c             |   4 +-
 src/box/sql/pragma.h             |  92 +++---
 src/box/sql/prepare.c            |  24 +-
 src/box/sql/update.c             |   2 +-
 src/box/sql/vdbe.c               |  16 +-
 src/box/sql/vdbeapi.c            |  16 +-
 test/sql-tap/func.test.lua       |   2 +-
 test/sql-tap/position.test.lua   |  16 +-
 test/sql-tap/sql-errors.test.lua |   4 +-
 test/sql/boolean.result          | 518 +++++++++++++++----------------
 test/sql/iproto.result           |  48 +--
 test/sql/row-count.result        |  10 +-
 test/sql/sql-debug.result        |   6 +-
 test/sql/types.result            |  42 +--
 17 files changed, 408 insertions(+), 407 deletions(-)

diff --git a/src/box/sql/delete.c b/src/box/sql/delete.c
index 2f73d80c9..91c2157ac 100644
--- a/src/box/sql/delete.c
+++ b/src/box/sql/delete.c
@@ -420,7 +420,7 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
 		sqlVdbeSetNumCols(v, 1);
 		sqlVdbeSetColName(v, 0, COLNAME_NAME, "rows deleted",
 				      SQL_STATIC);
-		sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "INTEGER",
+		sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "integer",
 				  SQL_STATIC);
 	}
 
diff --git a/src/box/sql/func.c b/src/box/sql/func.c
index 12a4bee04..3d2ec434b 100644
--- a/src/box/sql/func.c
+++ b/src/box/sql/func.c
@@ -559,7 +559,8 @@ position_func(struct sql_context *context, int argc, struct Mem **argv)
 	if (haystack_type != MP_STR && haystack_type != MP_BIN)
 		inconsistent_type_arg = haystack;
 	if (inconsistent_type_arg != NULL) {
-		diag_set(ClientError, ER_INCONSISTENT_TYPES, "TEXT or VARBINARY",
+		diag_set(ClientError, ER_INCONSISTENT_TYPES,
+			 "text or varbinary",
 			 mem_type_to_str(inconsistent_type_arg));
 		context->is_aborted = true;
 		return;
@@ -889,8 +890,8 @@ case_type##ICUFunc(sql_context *context, int argc, sql_value **argv)   \
 	UNUSED_PARAMETER(argc);                                                \
 	int arg_type = sql_value_type(argv[0]);                                \
 	if (arg_type == MP_BIN) {                                              \
-		diag_set(ClientError, ER_INCONSISTENT_TYPES, "TEXT",           \
-			 "VARBINARY");                                         \
+		diag_set(ClientError, ER_INCONSISTENT_TYPES, "text",           \
+			 "varbinary");                                         \
 		context->is_aborted = true;                                    \
 		return;                                                        \
 	}                                                                      \
@@ -1225,7 +1226,7 @@ likeFunc(sql_context *context, int argc, sql_value **argv)
 		char *inconsistent_type = rhs_type != MP_STR ?
 					  mem_type_to_str(argv[0]) :
 					  mem_type_to_str(argv[1]);
-		diag_set(ClientError, ER_INCONSISTENT_TYPES, "TEXT",
+		diag_set(ClientError, ER_INCONSISTENT_TYPES, "text",
 			 inconsistent_type);
 		context->is_aborted = true;
 		return;
@@ -1859,7 +1860,7 @@ soundexFunc(sql_context * context, int argc, sql_value ** argv)
 	assert(argc == 1);
 	if (sql_value_type(argv[0]) == MP_BIN) {
 		diag_set(ClientError, ER_SQL_TYPE_MISMATCH,
-			 sql_value_to_diag_str(argv[0]), "TEXT");
+			 sql_value_to_diag_str(argv[0]), "text");
 		context->is_aborted = true;
 		return;
 	}
diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
index 42b839166..70504c800 100644
--- a/src/box/sql/insert.c
+++ b/src/box/sql/insert.c
@@ -786,7 +786,7 @@ sqlInsert(Parse * pParse,	/* Parser context */
 		else
 			column_name = "rows inserted";
 		sqlVdbeSetColName(v, 0, COLNAME_NAME, column_name, SQL_STATIC);
-		sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "INTEGER",
+		sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "integer",
 				  SQL_STATIC);
 	}
 
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index 5bf24ef50..92bcf4e68 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -169,9 +169,9 @@ vdbe_emit_pragma_status(struct Parse *parse)
 
 	sqlVdbeSetNumCols(v, 2);
 	sqlVdbeSetColName(v, 0, COLNAME_NAME, "pragma_name", SQL_STATIC);
-	sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "TEXT", SQL_STATIC);
+	sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "text", SQL_STATIC);
 	sqlVdbeSetColName(v, 1, COLNAME_NAME, "pragma_value", SQL_STATIC);
-	sqlVdbeSetColName(v, 1, COLNAME_DECLTYPE, "INTEGER", SQL_STATIC);
+	sqlVdbeSetColName(v, 1, COLNAME_DECLTYPE, "integer", SQL_STATIC);
 
 	parse->nMem = 2;
 	for (int i = 0; i < ArraySize(aPragmaName); ++i) {
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index 02895b0ea..30a1fc41a 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -31,119 +31,119 @@
 static const char *const pragCName[] = {
 	/* Used by: table_info */
 	/*   0 */ "cid",
-	/*   1 */ "INTEGER",
+	/*   1 */ "integer",
 	/*   2 */ "name",
-	/*   3 */ "TEXT",
+	/*   3 */ "text",
 	/*   4 */ "type",
-	/*   3 */ "TEXT",
+	/*   3 */ "text",
 	/*   6 */ "notnull",
-	/*   1 */ "INTEGER",
+	/*   1 */ "integer",
 	/*   8 */ "dflt_value",
-	/*   9 */ "TEXT",
+	/*   9 */ "text",
 	/*  10 */ "pk",
-	/*  11 */ "INTEGER",
+	/*  11 */ "integer",
 	/* Used by: stats */
 	/*  12 */ "table",
-	/*  13 */ "TEXT",
+	/*  13 */ "text",
 	/*  14 */ "index",
-	/*  15 */ "TEXT",
+	/*  15 */ "text",
 	/*  16 */ "width",
-	/*  17 */ "INTEGER",
+	/*  17 */ "integer",
 	/*  18 */ "height",
-	/*  19 */ "INTEGER",
+	/*  19 */ "integer",
 	/* Used by: index_info */
 	/*  20 */ "seqno",
-	/*  21 */ "INTEGER",
+	/*  21 */ "integer",
 	/*  22 */ "cid",
-	/*  23 */ "INTEGER",
+	/*  23 */ "integer",
 	/*  24 */ "name",
-	/*  25 */ "TEXT",
+	/*  25 */ "text",
 	/*  26 */ "desc",
-	/*  27 */ "INTEGER",
+	/*  27 */ "integer",
 	/*  28 */ "coll",
-	/*  29 */ "TEXT",
+	/*  29 */ "text",
 	/*  30 */ "type",
-	/*  31 */ "TEXT",
+	/*  31 */ "text",
 	/* Used by: index_list */
 	/*  32 */ "seq",
-	/*  33 */ "INTEGER",
+	/*  33 */ "integer",
 	/*  34 */ "name",
-	/*  35 */ "TEXT",
+	/*  35 */ "text",
 	/*  36 */ "unique",
-	/*  37 */ "INTEGER",
+	/*  37 */ "integer",
 	/* Used by: collation_list */
 	/*  38 */ "seq",
-	/*  39 */ "INTEGER",
+	/*  39 */ "integer",
 	/*  40 */ "name",
-	/*  41 */ "TEXT",
+	/*  41 */ "text",
 	/* Used by: foreign_key_list */
 	/*  42 */ "id",
-	/*  43 */ "INTEGER",
+	/*  43 */ "integer",
 	/*  44 */ "seq",
-	/*  45 */ "INTEGER",
+	/*  45 */ "integer",
 	/*  46 */ "table",
-	/*  47 */ "TEXT",
+	/*  47 */ "text",
 	/*  48 */ "from",
-	/*  49 */ "TEXT",
+	/*  49 */ "text",
 	/*  50 */ "to",
-	/*  51 */ "TEXT",
+	/*  51 */ "text",
 	/*  52 */ "on_update",
-	/*  53 */ "TEXT",
+	/*  53 */ "text",
 	/*  54 */ "on_delete",
-	/*  55 */ "TEXT",
+	/*  55 */ "text",
 	/*  56 */ "match",
-	/*  57 */ "TEXT",
+	/*  57 */ "text",
 	/* Used by: count_changes */
 	/*  58 */ "count_changes",
-	/*  59 */ "INTEGER",
+	/*  59 */ "integer",
 	/* Used by: defer_foreign_keys */
 	/*  60 */ "defer_foreign_keys",
-	/*  61 */ "INTEGER",
+	/*  61 */ "integer",
 	/* Used by: full_column_names */
 	/*  62 */ "full_column_names",
-	/*  63 */ "INTEGER",
+	/*  63 */ "integer",
 	/* Used by: parser_trace */
 	/*  64 */ "parser_trace",
-	/*  65 */ "INTEGER",
+	/*  65 */ "integer",
 	/* Used by: recursive_triggers */
 	/*  66 */ "recursive_triggers",
-	/*  67 */ "INTEGER",
+	/*  67 */ "integer",
 	/* Used by: reverse_unordered_selects */
 	/*  68 */ "reverse_unordered_selects",
-	/*  69 */ "INTEGER",
+	/*  69 */ "integer",
 	/* Used by: select_trace */
 	/*  70 */ "select_trace",
-	/*  71 */ "INTEGER",
+	/*  71 */ "integer",
 	/* Used by: short_column_names */
 	/*  72 */ "short_column_names",
-	/*  73 */ "INTEGER",
+	/*  73 */ "integer",
 	/* Used by: sql_compound_select_limit */
 	/*  74 */ "sql_compound_select_limit",
-	/*  75 */ "INTEGER",
+	/*  75 */ "integer",
 	/* Used by: sql_default_engine */
 	/*  76 */ "sql_default_engine",
-	/*  77 */ "TEXT",
+	/*  77 */ "text",
 	/* Used by: sql_trace */
 	/*  78 */ "sql_trace",
-	/*  79 */ "INTEGER",
+	/*  79 */ "integer",
 	/* Used by: vdbe_addoptrace */
 	/*  80 */ "vdbe_addoptrace",
-	/*  81 */ "INTEGER",
+	/*  81 */ "integer",
 	/* Used by: vdbe_debug */
 	/*  82 */ "vdbe_debug",
-	/*  83 */ "INTEGER",
+	/*  83 */ "integer",
 	/* Used by: vdbe_eqp */
 	/*  84 */ "vdbe_eqp",
-	/*  85 */ "INTEGER",
+	/*  85 */ "integer",
 	/* Used by: vdbe_listing */
 	/*  86 */ "vdbe_listing",
-	/*  87 */ "INTEGER",
+	/*  87 */ "integer",
 	/* Used by: vdbe_trace */
 	/*  88 */ "vdbe_trace",
-	/*  89 */ "INTEGER",
+	/*  89 */ "integer",
 	/* Used by: where_trace */
 	/*  90 */ "where_trace",
-	/*  91 */ "INTEGER",
+	/*  91 */ "integer",
 };
 
 /* Definitions of all built-in pragmas */
diff --git a/src/box/sql/prepare.c b/src/box/sql/prepare.c
index e077a8b5e..0ecc676e2 100644
--- a/src/box/sql/prepare.c
+++ b/src/box/sql/prepare.c
@@ -110,29 +110,29 @@ sqlPrepare(sql * db,	/* Database handle. */
 	if (rc == 0 && sParse.pVdbe != NULL && sParse.explain) {
 		static const char *const azColName[] = {
 			/*  0 */ "addr",
-			/*  1 */ "INTEGER",
+			/*  1 */ "integer",
 			/*  2 */ "opcode",
-			/*  3 */ "TEXT",
+			/*  3 */ "text",
 			/*  4 */ "p1",
-			/*  5 */ "INTEGER",
+			/*  5 */ "integer",
 			/*  6 */ "p2",
-			/*  7 */ "INTEGER",
+			/*  7 */ "integer",
 			/*  8 */ "p3",
-			/*  9 */ "INTEGER",
+			/*  9 */ "integer",
 			/* 10 */ "p4",
-			/* 11 */ "TEXT",
+			/* 11 */ "text",
 			/* 12 */ "p5",
-			/* 13 */ "TEXT",
+			/* 13 */ "text",
 			/* 14 */ "comment",
-			/* 15 */ "TEXT",
+			/* 15 */ "text",
 			/* 16 */ "selectid",
-			/* 17 */ "INTEGER",
+			/* 17 */ "integer",
 			/* 18 */ "order",
-			/* 19 */ "INTEGER",
+			/* 19 */ "integer",
 			/* 20 */ "from",
-			/* 21 */ "INTEGER",
+			/* 21 */ "integer",
 			/* 22 */ "detail",
-			/* 23 */ "TEXT",
+			/* 23 */ "text",
 		};
 
 		int name_first, name_count;
diff --git a/src/box/sql/update.c b/src/box/sql/update.c
index 2d7ebf8cd..6d69b7252 100644
--- a/src/box/sql/update.c
+++ b/src/box/sql/update.c
@@ -500,7 +500,7 @@ sqlUpdate(Parse * pParse,		/* The parser context */
 		sqlVdbeSetNumCols(v, 1);
 		sqlVdbeSetColName(v, 0, COLNAME_NAME, "rows updated",
 				      SQL_STATIC);
-		sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "INTEGER",
+		sqlVdbeSetColName(v, 0, COLNAME_DECLTYPE, "integer",
 				  SQL_STATIC);
 	}
 
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index f881a732e..15fe50b63 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -612,17 +612,17 @@ mem_type_to_str(const struct Mem *p)
 	case MEM_Null:
 		return "NULL";
 	case MEM_Str:
-		return "TEXT";
+		return "text";
 	case MEM_Int:
-		return "INTEGER";
+		return "integer";
 	case MEM_UInt:
-		return "UNSIGNED";
+		return "unsigned";
 	case MEM_Real:
-		return "REAL";
+		return "real";
 	case MEM_Blob:
-		return "VARBINARY";
+		return "varbinary";
 	case MEM_Bool:
-		return "BOOLEAN";
+		return "boolean";
 	default:
 		unreachable();
 	}
@@ -1507,8 +1507,8 @@ case OP_Concat: {           /* same as TK_CONCAT, in1, in2, out3 */
 		char *inconsistent_type = str_type_p1 == 0 ?
 					  mem_type_to_str(pIn1) :
 					  mem_type_to_str(pIn2);
-		diag_set(ClientError, ER_INCONSISTENT_TYPES, "TEXT or VARBINARY",
-			 inconsistent_type);
+		diag_set(ClientError, ER_INCONSISTENT_TYPES,
+			 "text or varbinary", inconsistent_type);
 		goto abort_due_to_error;
 	}
 
diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
index b91d16a9d..685212d91 100644
--- a/src/box/sql/vdbeapi.c
+++ b/src/box/sql/vdbeapi.c
@@ -893,7 +893,7 @@ bindText(sql_stmt * pStmt,	/* The statement to bind against */
 	pVar = &p->aVar[i - 1];
 	if (sqlVdbeMemSetStr(pVar, zData, nData, 1, xDel) != 0)
 		return -1;
-	return sql_bind_type(p, i, "TEXT");
+	return sql_bind_type(p, i, "text");
 }
 
 /*
@@ -915,7 +915,7 @@ sql_bind_blob(sql_stmt * pStmt,
 	struct Mem *var = &p->aVar[i - 1];
 	if (sqlVdbeMemSetStr(var, zData, nData, 0, xDel) != 0)
 		return -1;
-	return sql_bind_type(p, i, "VARBINARY");
+	return sql_bind_type(p, i, "varbinary");
 }
 
 int
@@ -939,7 +939,7 @@ sql_bind_double(sql_stmt * pStmt, int i, double rValue)
 	Vdbe *p = (Vdbe *) pStmt;
 	if (vdbeUnbind(p, i) != 0)
 		return -1;
-	int rc = sql_bind_type(p, i, "NUMERIC");
+	int rc = sql_bind_type(p, i, "numeric");
 	sqlVdbeMemSetDouble(&p->aVar[i - 1], rValue);
 	return rc;
 }
@@ -950,7 +950,7 @@ sql_bind_boolean(struct sql_stmt *stmt, int i, bool value)
 	struct Vdbe *p = (struct Vdbe *) stmt;
 	if (vdbeUnbind(p, i) != 0)
 		return -1;
-	int rc = sql_bind_type(p, i, "BOOLEAN");
+	int rc = sql_bind_type(p, i, "boolean");
 	mem_set_bool(&p->aVar[i - 1], value);
 	return rc;
 }
@@ -967,7 +967,7 @@ sql_bind_int64(sql_stmt * pStmt, int i, sql_int64 iValue)
 	Vdbe *p = (Vdbe *) pStmt;
 	if (vdbeUnbind(p, i) != 0)
 		return -1;
-	int rc = sql_bind_type(p, i, "INTEGER");
+	int rc = sql_bind_type(p, i, "integer");
 	assert(iValue < 0);
 	mem_set_int(&p->aVar[i - 1], iValue, true);
 	return rc;
@@ -979,7 +979,7 @@ sql_bind_uint64(struct sql_stmt *stmt, int i, uint64_t value)
 	struct Vdbe *p = (struct Vdbe *) stmt;
 	if (vdbeUnbind(p, i) != 0)
 		return -1;
-	int rc = sql_bind_type(p, i, "INTEGER");
+	int rc = sql_bind_type(p, i, "integer");
 	mem_set_u64(&p->aVar[i - 1], value);
 	return rc;
 }
@@ -990,7 +990,7 @@ sql_bind_null(sql_stmt * pStmt, int i)
 	Vdbe *p = (Vdbe *) pStmt;
 	if (vdbeUnbind(p, i) != 0)
 		return -1;
-	return sql_bind_type(p, i, "BOOLEAN");
+	return sql_bind_type(p, i, "boolean");
 }
 
 int
@@ -999,7 +999,7 @@ sql_bind_ptr(struct sql_stmt *stmt, int i, void *ptr)
 	struct Vdbe *p = (struct Vdbe *) stmt;
 	int rc = vdbeUnbind(p, i);
 	if (rc == 0) {
-		rc = sql_bind_type(p, i, "VARBINARY");
+		rc = sql_bind_type(p, i, "varbinary");
 		mem_set_ptr(&p->aVar[i - 1], ptr);
 	}
 	return rc;
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index e65fba150..4574ddfeb 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -2938,7 +2938,7 @@ test:do_catchsql_test(
         SELECT SOUNDEX(X'FF')
     ]], {
         -- <func-76.3>
-        1, "Type mismatch: can not convert varbinary to TEXT"
+        1, "Type mismatch: can not convert varbinary to text"
         -- </func-76.3>
     })
 
diff --git a/test/sql-tap/position.test.lua b/test/sql-tap/position.test.lua
index 9539f7bf7..e0455abc9 100755
--- a/test/sql-tap/position.test.lua
+++ b/test/sql-tap/position.test.lua
@@ -228,7 +228,7 @@ test:do_test(
         return test:catchsql "SELECT position(34, 12345);"
     end, {
         -- <position-1.23>
-        1, "Inconsistent types: expected TEXT or VARBINARY got UNSIGNED"
+        1, "Inconsistent types: expected text or varbinary got unsigned"
         -- </position-1.23>
     })
 
@@ -238,7 +238,7 @@ test:do_test(
         return test:catchsql "SELECT position(34, 123456.78);"
     end, {
         -- <position-1.24>
-        1, "Inconsistent types: expected TEXT or VARBINARY got REAL"
+        1, "Inconsistent types: expected text or varbinary got real"
         -- </position-1.24>
     })
 
@@ -248,7 +248,7 @@ test:do_test(
         return test:catchsql "SELECT position(x'3334', 123456.78);"
     end, {
         -- <position-1.25>
-        1, "Inconsistent types: expected TEXT or VARBINARY got REAL"
+        1, "Inconsistent types: expected text or varbinary got real"
         -- </position-1.25>
     })
 
@@ -554,7 +554,7 @@ test:do_test(
         return test:catchsql("SELECT position('x', x'78c3a4e282ac79');")
     end, {
         -- <position-1.54>
-        1, "Inconsistent types: expected TEXT got VARBINARY"
+        1, "Inconsistent types: expected text got varbinary"
         -- </position-1.54>
     })
 
@@ -564,7 +564,7 @@ test:do_test(
         return test:catchsql "SELECT position('y', x'78c3a4e282ac79');"
     end, {
         -- <position-1.55>
-        1, "Inconsistent types: expected TEXT got VARBINARY"
+        1, "Inconsistent types: expected text got varbinary"
         -- </position-1.55>
     })
 
@@ -614,7 +614,7 @@ test:do_test(
         return test:catchsql "SELECT position(x'79', 'xä€y');"
     end, {
         -- <position-1.57.1>
-        1, "Inconsistent types: expected VARBINARY got TEXT"
+        1, "Inconsistent types: expected varbinary got text"
         -- </position-1.57.1>
     })
 
@@ -624,7 +624,7 @@ test:do_test(
         return test:catchsql "SELECT position(x'a4', 'xä€y');"
     end, {
         -- <position-1.57.2>
-        1, "Inconsistent types: expected VARBINARY got TEXT"
+        1, "Inconsistent types: expected varbinary got text"
         -- </position-1.57.2>
     })
 
@@ -634,7 +634,7 @@ test:do_test(
         return test:catchsql "SELECT position('y', x'78c3a4e282ac79');"
     end, {
         -- <position-1.57.3>
-        1, "Inconsistent types: expected TEXT got VARBINARY"
+        1, "Inconsistent types: expected text got varbinary"
         -- </position-1.57.3>
     })
 
diff --git a/test/sql-tap/sql-errors.test.lua b/test/sql-tap/sql-errors.test.lua
index cb8952424..b16337682 100755
--- a/test/sql-tap/sql-errors.test.lua
+++ b/test/sql-tap/sql-errors.test.lua
@@ -765,7 +765,7 @@ test:do_catchsql_test(
 		SELECT X'ff' >= false;
 	]], {
 		-- <sql-errors-2.8>
-		1, "Type mismatch: can not convert VARBINARY to BOOLEAN"
+		1, "Type mismatch: can not convert varbinary to boolean"
 		-- </sql-errors-2.8>
 	})
 
@@ -775,7 +775,7 @@ test:do_catchsql_test(
 		SELECT X'ff' <= false;
 	]], {
 		-- <sql-errors-2.9>
-		1, "Type mismatch: can not convert VARBINARY to BOOLEAN"
+		1, "Type mismatch: can not convert varbinary to boolean"
 		-- </sql-errors-2.9>
 	})
 
diff --git a/test/sql/boolean.result b/test/sql/boolean.result
index 191fa33f3..913cd9408 100644
--- a/test/sql/boolean.result
+++ b/test/sql/boolean.result
@@ -138,12 +138,12 @@ INSERT INTO ts(s) VALUES ('abc'), (12.5);
 SELECT s FROM ts WHERE s = true;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT s FROM ts WHERE s < true;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT s FROM ts WHERE s IN (true, 1, 'abcd');
  | ---
@@ -203,13 +203,13 @@ EXPLAIN QUERY PLAN SELECT a FROM t0 WHERE a = true;
  | ---
  | - metadata:
  |   - name: selectid
- |     type: INTEGER
+ |     type: integer
  |   - name: order
- |     type: INTEGER
+ |     type: integer
  |   - name: from
- |     type: INTEGER
+ |     type: integer
  |   - name: detail
- |     type: TEXT
+ |     type: text
  |   rows:
  |   - [0, 0, 0, 'SEARCH TABLE T0 USING COVERING INDEX I0 (A=?) (~10 rows)']
  | ...
@@ -276,7 +276,7 @@ SELECT is_boolean('true');
 SELECT abs(a) FROM t0;
  | ---
  | - null
- | - 'Inconsistent types: expected number got BOOLEAN'
+ | - 'Inconsistent types: expected number got boolean'
  | ...
 SELECT lower(a) FROM t0;
  | ---
@@ -393,9 +393,9 @@ box.execute('SELECT ?, ?, return_type($1), typeof($2);', {true, false})
  | ---
  | - metadata:
  |   - name: '?'
- |     type: BOOLEAN
+ |     type: boolean
  |   - name: '?'
- |     type: BOOLEAN
+ |     type: boolean
  |   - name: return_type($1)
  |     type: string
  |   - name: typeof($2)
@@ -423,9 +423,9 @@ box.execute('SELECT :value1, @value2;', parameters)
  | ---
  | - metadata:
  |   - name: :value1
- |     type: BOOLEAN
+ |     type: boolean
  |   - name: '@value2'
- |     type: BOOLEAN
+ |     type: boolean
  |   rows:
  |   - [false, true]
  | ...
@@ -1553,64 +1553,64 @@ SELECT a, a1, a >> a1 FROM t, t6;
 SELECT true || true;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT true || false;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT false || true;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT false || false;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 
 SELECT a, true || a FROM t;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT a, false || a FROM t;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT a, a || true FROM t;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT a, a || false FROM t;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 
 SELECT a1, a1 || a1 FROM t6;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT a2, a2 || a2 FROM t6;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT a1, a2, a1 || a1 FROM t6;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT a1, a2, a2 || a2 FROM t6;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 
 -- Check comparisons.
@@ -3364,493 +3364,493 @@ SELECT a2, b, b >> a2 FROM t6, t7;
 SELECT true > 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT false > 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT true < 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT false < 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 > true;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 > false;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 < true;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 < false;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT a1, a1 > 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, a1 < 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, 2 > a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, 2 < a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, a2 > 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, a2 < 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, 2 > a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, 2 < a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT b, true > b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, false > b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, true < b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, false < b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b > true FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b > false FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b < true FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b < false FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT a1, b, a1 > b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, a1 < b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, b > a1 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, b < a1 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, a2 > b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, a2 < b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, b > a2 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, b < a2 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT true >= 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT false >= 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT true <= 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT false <= 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 >= true;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 >= false;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 <= true;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 <= false;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT a1, a1 >= 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, a1 <= 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, 2 >= a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, 2 <= a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, a2 >= 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, a2 <= 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, 2 >= a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, 2 <= a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT b, true >= b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, false >= b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, true <= b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, false <= b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b >= true FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b >= false FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b <= true FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b <= false FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT a1, b, a1 >= b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, a1 <= b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, b >= a1 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, b <= a1 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, a2 >= b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, a2 <= b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, b >= a2 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, b <= a2 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT true == 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT false == 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT true != 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT false != 2;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 == true;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 == false;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 != true;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT 2 != false;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT a1, a1 == 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, a1 != 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, 2 == a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, 2 != a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, a2 == 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, a2 != 2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, 2 == a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, 2 != a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT b, true == b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, false == b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, true != b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, false != b FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b == true FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b == false FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b != true FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT b, b != false FROM t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT a1, b, a1 == b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, a1 != b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, b == a1 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, b, b != a1 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, a2 == b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, a2 != b FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, b == a2 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, b, b != a2 FROM t6, t7;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 SELECT true IN (0, 1, 2, 3);
@@ -3894,22 +3894,22 @@ SELECT a1, a1 IN (0, 1, 2, 3) FROM t6
 SELECT true BETWEEN 0 and 10;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT false BETWEEN 0 and 10;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a1, a1 BETWEEN 0 and 10 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 SELECT a2, a2 BETWEEN 0 and 10 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+ | - 'Type mismatch: can not convert unsigned to boolean'
  | ...
 
 -- Check interaction of BOOLEAN and NUMBER.
@@ -4509,493 +4509,493 @@ SELECT a2, c, c % a2 FROM t6, t8;
 SELECT true > 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT false > 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT true < 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT false < 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 > true;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 > false;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 < true;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 < false;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT a1, a1 > 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, a1 < 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, 2.3 > a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, 2.3 < a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, a2 > 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, a2 < 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, 2.3 > a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, 2.3 < a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT c, true > c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, false > c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, true < c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, false < c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c > true FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c > false FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c < true FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c < false FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT a1, c, a1 > c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, a1 < c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, c > a1 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, c < a1 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, a2 > c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, a2 < c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, c > a2 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, c < a2 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT true >= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT false >= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT true <= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT false <= 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 >= true;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 >= false;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 <= true;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 <= false;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT a1, a1 >= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, a1 <= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, 2.3 >= a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, 2.3 <= a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, a2 >= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, a2 <= 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, 2.3 >= a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, 2.3 <= a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT c, true >= c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, false >= c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, true <= c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, false <= c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c >= true FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c >= false FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c <= true FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c <= false FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT a1, c, a1 >= c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, a1 <= c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, c >= a1 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, c <= a1 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, a2 >= c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, a2 <= c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, c >= a2 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, c <= a2 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT true == 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT false == 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT true != 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT false != 2.3;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 == true;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 == false;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 != true;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT 2.3 != false;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT a1, a1 == 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, a1 != 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, 2.3 == a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, 2.3 != a1 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, a2 == 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, a2 != 2.3 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, 2.3 == a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, 2.3 != a2 FROM t6
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT c, true == c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, false == c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, true != c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, false != c FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c == true FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c == false FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c != true FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT c, c != false FROM t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT a1, c, a1 == c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, a1 != c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, c == a1 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, c, c != a1 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, a2 == c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, a2 != c FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, c == a2 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, c, c != a2 FROM t6, t8;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 SELECT true IN (0.1, 1.2, 2.3, 3.4);
@@ -5054,22 +5054,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 REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT false BETWEEN 0.1 and 9.9;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a1, a1 BETWEEN 0.1 and 9.9 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 SELECT a2, a2 BETWEEN 0.1 and 9.9 FROM t6;
  | ---
  | - null
- | - 'Type mismatch: can not convert REAL to BOOLEAN'
+ | - 'Type mismatch: can not convert real to boolean'
  | ...
 
 -- Check interaction of BOOLEAN and TEXT.
@@ -5265,187 +5265,187 @@ SELECT a2, d, d OR a2 FROM t6, t9;
 SELECT true > 'abc';
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT false > 'abc';
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT true < 'abc';
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT false < 'abc';
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT 'abc' > true;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT 'abc' > false;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT 'abc' < true;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT 'abc' < false;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 
 SELECT d, true > d FROM t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT d, false > d FROM t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT d, true < d FROM t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT d, false < d FROM t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT d, d > true FROM t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT d, d > false FROM t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT d, d < true FROM t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT d, d < false FROM t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 
 SELECT a1, d, a1 > d FROM t6, t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT a1, d, a1 < d FROM t6, t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT a1, d, d > a1 FROM t6, t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT a1, d, d < a1 FROM t6, t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT a2, d, a2 > d FROM t6, t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT a2, d, a2 < d FROM t6, t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT a2, d, d > a2 FROM t6, t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 SELECT a2, d, d < a2 FROM t6, t9;
  | ---
  | - null
- | - 'Type mismatch: can not convert TEXT to BOOLEAN'
+ | - 'Type mismatch: can not convert text to boolean'
  | ...
 
 SELECT true || 'abc';
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT false || 'abc';
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT 'abc' || false;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT 'abc' || true;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 
 SELECT d, true || d FROM t9;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT d, false || d FROM t9;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT d, d || false FROM t9;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT d, d || true FROM t9;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 
 SELECT d, a1 || d FROM t6, t9;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT d, a2 || d FROM t6, t9;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT d, d || a1 FROM t6, t9;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 SELECT d, d || a2 FROM t6, t9;
  | ---
  | - null
- | - 'Inconsistent types: expected TEXT or VARBINARY got BOOLEAN'
+ | - 'Inconsistent types: expected text or varbinary got boolean'
  | ...
 
 --
diff --git a/test/sql/iproto.result b/test/sql/iproto.result
index 1e5c30aec..67acd0ac1 100644
--- a/test/sql/iproto.result
+++ b/test/sql/iproto.result
@@ -374,11 +374,11 @@ cn:execute('select $2, $1, $3', parameters)
 ---
 - metadata:
   - name: $2
-    type: INTEGER
+    type: integer
   - name: $1
-    type: INTEGER
+    type: integer
   - name: $3
-    type: INTEGER
+    type: integer
   rows:
   - [22, 11, 33]
 ...
@@ -683,17 +683,17 @@ res = cn:execute("PRAGMA table_info(t1)")
 res.metadata
 ---
 - - name: cid
-    type: INTEGER
+    type: integer
   - name: name
-    type: TEXT
+    type: text
   - name: type
-    type: TEXT
+    type: text
   - name: notnull
-    type: INTEGER
+    type: integer
   - name: dflt_value
-    type: TEXT
+    type: text
   - name: pk
-    type: INTEGER
+    type: integer
 ...
 -- EXPLAIN
 res = cn:execute("EXPLAIN SELECT 1")
@@ -702,21 +702,21 @@ res = cn:execute("EXPLAIN SELECT 1")
 res.metadata
 ---
 - - name: addr
-    type: INTEGER
+    type: integer
   - name: opcode
-    type: TEXT
+    type: text
   - name: p1
-    type: INTEGER
+    type: integer
   - name: p2
-    type: INTEGER
+    type: integer
   - name: p3
-    type: INTEGER
+    type: integer
   - name: p4
-    type: TEXT
+    type: text
   - name: p5
-    type: TEXT
+    type: text
   - name: comment
-    type: TEXT
+    type: text
 ...
 res = cn:execute("EXPLAIN QUERY PLAN SELECT COUNT(*) FROM t1")
 ---
@@ -724,13 +724,13 @@ res = cn:execute("EXPLAIN QUERY PLAN SELECT COUNT(*) FROM t1")
 res.metadata
 ---
 - - name: selectid
-    type: INTEGER
+    type: integer
   - name: order
-    type: INTEGER
+    type: integer
   - name: from
-    type: INTEGER
+    type: integer
   - name: detail
-    type: TEXT
+    type: text
 ...
 -- When pragma count_changes is on, statements INSERT, REPLACE and
 -- UPDATE returns number of changed columns. Make sure that this
@@ -743,7 +743,7 @@ cn:execute("INSERT INTO t1 VALUES (1), (2), (3);")
 ---
 - metadata:
   - name: rows inserted
-    type: INTEGER
+    type: integer
   rows:
   - [3]
 ...
@@ -751,7 +751,7 @@ cn:execute("REPLACE INTO t1 VALUES (2), (3), (4), (5);")
 ---
 - metadata:
   - name: rows replaced
-    type: INTEGER
+    type: integer
   rows:
   - [4]
 ...
@@ -759,7 +759,7 @@ cn:execute("UPDATE t1 SET id = id + 100 WHERE id > 10;")
 ---
 - metadata:
   - name: rows updated
-    type: INTEGER
+    type: integer
   rows:
   - [0]
 ...
diff --git a/test/sql/row-count.result b/test/sql/row-count.result
index fb96e213c..6bf74ed9b 100644
--- a/test/sql/row-count.result
+++ b/test/sql/row-count.result
@@ -296,13 +296,13 @@ box.execute("EXPLAIN QUERY PLAN INSERT INTO t1 VALUES ('b'), ('c'), ('d');")
 ---
 - metadata:
   - name: selectid
-    type: INTEGER
+    type: integer
   - name: order
-    type: INTEGER
+    type: integer
   - name: from
-    type: INTEGER
+    type: integer
   - name: detail
-    type: TEXT
+    type: text
   rows:
   - [0, 0, 0, 'SCAN TABLE T2 (~262144 rows)']
 ...
@@ -318,7 +318,7 @@ box.execute('PRAGMA recursive_triggers')
 ---
 - metadata:
   - name: recursive_triggers
-    type: INTEGER
+    type: integer
   rows:
   - [1]
 ...
diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
index 2dba6844a..b19075366 100644
--- a/test/sql/sql-debug.result
+++ b/test/sql/sql-debug.result
@@ -19,7 +19,7 @@ box.execute('PRAGMA parser_trace')
 ---
 - metadata:
   - name: parser_trace
-    type: INTEGER
+    type: integer
   rows:
   - [1]
 ...
@@ -34,9 +34,9 @@ box.execute('PRAGMA')
 ---
 - metadata:
   - name: pragma_name
-    type: TEXT
+    type: text
   - name: pragma_value
-    type: INTEGER
+    type: integer
   rows:
   - ['count_changes', 0]
   - ['defer_foreign_keys', 0]
diff --git a/test/sql/types.result b/test/sql/types.result
index 1bb8b0cec..2f7c61cb5 100644
--- a/test/sql/types.result
+++ b/test/sql/types.result
@@ -155,39 +155,39 @@ sp:drop()
 box.execute("SELECT 'abc' || 1;")
 ---
 - null
-- 'Inconsistent types: expected TEXT or VARBINARY got UNSIGNED'
+- 'Inconsistent types: expected text or varbinary got unsigned'
 ...
 box.execute("SELECT 'abc' || 1.123;")
 ---
 - null
-- 'Inconsistent types: expected TEXT or VARBINARY got REAL'
+- 'Inconsistent types: expected text or varbinary got real'
 ...
 box.execute("SELECT 1 || 'abc';")
 ---
 - null
-- 'Inconsistent types: expected TEXT or VARBINARY got UNSIGNED'
+- 'Inconsistent types: expected text or varbinary got unsigned'
 ...
 box.execute("SELECT 1.123 || 'abc';")
 ---
 - null
-- 'Inconsistent types: expected TEXT or VARBINARY got REAL'
+- 'Inconsistent types: expected text or varbinary got real'
 ...
 box.execute("SELECt 'a' || 'b' || 1;")
 ---
 - null
-- 'Inconsistent types: expected TEXT or VARBINARY got UNSIGNED'
+- 'Inconsistent types: expected text or varbinary got unsigned'
 ...
 -- What is more, they must be of the same type.
 --
 box.execute("SELECT 'abc' || randomblob(5);")
 ---
 - null
-- 'Inconsistent types: expected TEXT got VARBINARY'
+- 'Inconsistent types: expected text got varbinary'
 ...
 box.execute("SELECT randomblob(5) || 'x';")
 ---
 - null
-- 'Inconsistent types: expected VARBINARY got TEXT'
+- 'Inconsistent types: expected varbinary got text'
 ...
 -- Result of BLOBs concatenation must be BLOB.
 --
@@ -212,17 +212,17 @@ box.execute("INSERT INTO t1 VALUES (randomblob(5));")
 box.execute("SELECT * FROM t1 WHERE s LIKE 'blob';")
 ---
 - null
-- 'Inconsistent types: expected TEXT got VARBINARY'
+- 'Inconsistent types: expected text got varbinary'
 ...
 box.execute("SELECT * FROM t1 WHERE 'blob' LIKE s;")
 ---
 - null
-- 'Inconsistent types: expected TEXT got VARBINARY'
+- 'Inconsistent types: expected text got varbinary'
 ...
 box.execute("SELECT * FROM t1 WHERE 'blob' LIKE x'0000';")
 ---
 - null
-- 'Inconsistent types: expected TEXT got VARBINARY'
+- 'Inconsistent types: expected text got varbinary'
 ...
 box.execute("SELECT s LIKE NULL FROM t1;")
 ---
@@ -243,12 +243,12 @@ box.execute("INSERT INTO t1 VALUES (1);")
 box.execute("SELECT * FROM t1 WHERE s LIKE 'int';")
 ---
 - null
-- 'Inconsistent types: expected TEXT got UNSIGNED'
+- 'Inconsistent types: expected text got unsigned'
 ...
 box.execute("SELECT * FROM t1 WHERE 'int' LIKE 4;")
 ---
 - null
-- 'Inconsistent types: expected TEXT got UNSIGNED'
+- 'Inconsistent types: expected text got unsigned'
 ...
 box.execute("SELECT NULL LIKE s FROM t1;")
 ---
@@ -326,7 +326,7 @@ box.execute('SELECT ?', {true})
 ---
 - metadata:
   - name: '?'
-    type: BOOLEAN
+    type: boolean
   rows:
   - [true]
 ...
@@ -354,12 +354,12 @@ box.execute("SELECT * FROM tboolean WHERE s1 = 'abc';")
 box.execute("SELECT * FROM tboolean WHERE s1 = 1;")
 ---
 - null
-- 'Type mismatch: can not convert UNSIGNED to BOOLEAN'
+- 'Type mismatch: can not convert unsigned to boolean'
 ...
 box.execute("SELECT * FROM tboolean WHERE s1 = 1.123;")
 ---
 - null
-- 'Type mismatch: can not convert REAL to BOOLEAN'
+- 'Type mismatch: can not convert real to boolean'
 ...
 box.space.TBOOLEAN:drop()
 ---
@@ -1246,17 +1246,17 @@ box.execute("INSERT INTO t VALUES(1, x'616263');")
 box.execute("SELECT * FROM t WHERE v = 1")
 ---
 - null
-- 'Type mismatch: can not convert UNSIGNED to VARBINARY'
+- 'Type mismatch: can not convert unsigned to varbinary'
 ...
 box.execute("SELECT * FROM t WHERE v = 1.123")
 ---
 - null
-- 'Type mismatch: can not convert REAL to VARBINARY'
+- 'Type mismatch: can not convert real to varbinary'
 ...
 box.execute("SELECT * FROM t WHERE v = 'str'")
 ---
 - null
-- 'Type mismatch: can not convert TEXT to VARBINARY'
+- 'Type mismatch: can not convert text to varbinary'
 ...
 box.execute("SELECT * FROM t WHERE v = x'616263'")
 ---
@@ -1318,17 +1318,17 @@ box.execute("SELECT group_concat(v) FROM t;")
 box.execute("SELECT lower(v) FROM t;")
 ---
 - null
-- 'Inconsistent types: expected TEXT got VARBINARY'
+- 'Inconsistent types: expected text got varbinary'
 ...
 box.execute("SELECT upper(v) FROM t;")
 ---
 - null
-- 'Inconsistent types: expected TEXT got VARBINARY'
+- 'Inconsistent types: expected text got varbinary'
 ...
 box.execute("SELECT abs(v) FROM t;")
 ---
 - null
-- 'Inconsistent types: expected number got VARBINARY'
+- 'Inconsistent types: expected number got varbinary'
 ...
 box.execute("SELECT typeof(v) FROM t;")
 ---
-- 
2.21.0 (Apple Git-122)

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

* Re: [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase Vladislav Shpilevoy
@ 2019-10-28 14:08   ` Nikita Pettik
  2019-10-28 21:48     ` Vladislav Shpilevoy
  0 siblings, 1 reply; 10+ messages in thread
From: Nikita Pettik @ 2019-10-28 14:08 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches, tarantool-patches

On 27 Oct 22:35, Vladislav Shpilevoy wrote:
> Implicit cast uses lowercase, and the patch makes the
> explicit cast the same.
> 
> No any special reason behind that. Lower case is
> already used much more often, so it is easier to drop
> the upper case.
> 
> Part of #4462
> ---

Oh, unfortunately I've remembered the reason of using uppercase: it is
said so by ANSI (2011):

6.13 <cast specification>

...

11) If TD is variable-length character string or large object character
string, then let MLTD be the maximum length in characters of TD.

...

e) If SD is boolean, then

Case:

i) If SV is True and MLTD is not less than 4, then TV is 'TRUE'.

ii) If SV is False and MLTD is not less than 5, then TV is 'FALSE'

...

As for implicit cast - it is allowed neither in ANSI nor in Tarantool SQL.
However, some functions (like length or group_concat) anyway provide implicit
conversion from boolean to string. Why not simply disallow that?
Earlier I suggested to remove all dispatching logic from built-ins
implementations and instead generate OP_ApplyType with function's argument
and its assumed type. AfAIR Mergen faced some problems with that, but I
believe it is likely to be most general and correct solution.

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

* Re: [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere Vladislav Shpilevoy
@ 2019-10-28 14:23   ` Nikita Pettik
  2019-10-28 21:45     ` Vladislav Shpilevoy
  0 siblings, 1 reply; 10+ messages in thread
From: Nikita Pettik @ 2019-10-28 14:23 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches, tarantool-patches

On 27 Oct 22:35, Vladislav Shpilevoy wrote:
> Type was displayed in error messages, was returned in
> meta headers, and a type string is a result of
> typeof() SQL function.
> 
> Typeof() always returns lower case type string; meta
> contained upper case type; error messages contained
> both.
> 
> It was necessary to choose one case for everything,
> and the lower one was chosen. It allows not to break
> typeof() function which actually might be used by
> someone.
> 
> Part of #4462

CI status is negative: sql/bind.test.lua fails. Please, update result file.
The rest is OK as trivial. I want Kirill to look at this change and give
explicit ack for this change. In the latter case, it can be pushed out of order.

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

* Re: [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere
  2019-10-28 14:23   ` Nikita Pettik
@ 2019-10-28 21:45     ` Vladislav Shpilevoy
  2019-11-07 12:40       ` Nikita Pettik
  0 siblings, 1 reply; 10+ messages in thread
From: Vladislav Shpilevoy @ 2019-10-28 21:45 UTC (permalink / raw)
  To: Nikita Pettik; +Cc: tarantool-patches, tarantool-patches

Thanks for the review!

On 28/10/2019 15:23, Nikita Pettik wrote:
> On 27 Oct 22:35, Vladislav Shpilevoy wrote:
>> Type was displayed in error messages, was returned in
>> meta headers, and a type string is a result of
>> typeof() SQL function.
>>
>> Typeof() always returns lower case type string; meta
>> contained upper case type; error messages contained
>> both.
>>
>> It was necessary to choose one case for everything,
>> and the lower one was chosen. It allows not to break
>> typeof() function which actually might be used by
>> someone.
>>
>> Part of #4462
> 
> CI status is negative: sql/bind.test.lua fails. Please, update result file.

Fixed.

> The rest is OK as trivial. I want Kirill to look at this change and give
> explicit ack for this change. In the latter case, it can be pushed out of order.
> 

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

* Re: [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase
  2019-10-28 14:08   ` Nikita Pettik
@ 2019-10-28 21:48     ` Vladislav Shpilevoy
  0 siblings, 0 replies; 10+ messages in thread
From: Vladislav Shpilevoy @ 2019-10-28 21:48 UTC (permalink / raw)
  To: Nikita Pettik; +Cc: tarantool-patches, tarantool-patches

Hi! Thanks for the review!

On 28/10/2019 15:08, Nikita Pettik wrote:
> On 27 Oct 22:35, Vladislav Shpilevoy wrote:
>> Implicit cast uses lowercase, and the patch makes the
>> explicit cast the same.
>>
>> No any special reason behind that. Lower case is
>> already used much more often, so it is easier to drop
>> the upper case.
>>
>> Part of #4462
>> ---
> 
> Oh, unfortunately I've remembered the reason of using uppercase: it is
> said so by ANSI (2011):

Not unfortunately, it is good. Here is the incremental diff:

=======================================================================

diff --git a/src/box/sql/func.c b/src/box/sql/func.c
index 12a4bee04..ace5d1612 100644
--- a/src/box/sql/func.c
+++ b/src/box/sql/func.c
@@ -1411,8 +1411,9 @@ quoteFunc(sql_context * context, int argc, sql_value ** argv)
 			break;
 		}
 	case MP_BOOL: {
-		sql_result_text(context, sql_value_boolean(argv[0]) ?
-				"true" : "false", -1, SQL_TRANSIENT);
+		sql_result_text(context,
+				SQL_TOKEN_BOOLEAN(sql_value_boolean(argv[0])),
+				-1, SQL_TRANSIENT);
 		break;
 	}
 	default:{
diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
index c32cacc04..95eadbf87 100644
--- a/src/box/sql/sqlInt.h
+++ b/src/box/sql/sqlInt.h
@@ -306,6 +306,15 @@ struct sql_vfs {
 	*/
 };
 
+/**
+ * Canonical string representation of SQL BOOLEAN values.
+ * According to the standard it should be uppercase. See the 2011
+ * standard, cast specification 6.13, general rules 11.e.
+ */
+#define SQL_TOKEN_TRUE "TRUE"
+#define SQL_TOKEN_FALSE "FALSE"
+#define SQL_TOKEN_BOOLEAN(v) ({(v) ? SQL_TOKEN_TRUE : SQL_TOKEN_FALSE;})
+
 #define SQL_LIMIT_LENGTH                    0
 #define SQL_LIMIT_SQL_LENGTH                1
 #define SQL_LIMIT_COLUMN                    2
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index f881a732e..03c63d847 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -536,7 +536,7 @@ memTracePrint(Mem *p)
 	} else if (p->flags & MEM_Real) {
 		printf(" r:%g", p->u.r);
 	} else if (p->flags & MEM_Bool) {
-		printf(" bool:%s", p->u.b ? "true" : "false");
+		printf(" bool:%s", SQL_TOKEN_BOOLEAN(p->u.b));
 	} else {
 		char zBuf[200];
 		sqlVdbeMemPrettyPrint(p, zBuf);
diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c
index 6964c9097..2d37b62be 100644
--- a/src/box/sql/vdbemem.c
+++ b/src/box/sql/vdbemem.c
@@ -321,7 +321,8 @@ sqlVdbeMemStringify(Mem * pMem)
 		sql_snprintf(nByte, pMem->z, "%llu", pMem->u.u);
 		pMem->flags &= ~MEM_UInt;
 	} else if ((fg & MEM_Bool) != 0) {
-		sql_snprintf(nByte, pMem->z, "%s", pMem->u.b ? "true" : "false");
+		sql_snprintf(nByte, pMem->z, "%s",
+			     SQL_TOKEN_BOOLEAN(pMem->u.b));
 		pMem->flags &= ~MEM_Bool;
 	} else if (mem_has_msgpack_subtype(pMem)) {
 		sql_snprintf(nByte, pMem->z, "%s", value);
@@ -645,10 +646,11 @@ str_cast_to_boolean(const char *str, bool *result)
 {
 	assert(str != NULL);
 	for (; *str == ' '; str++);
-	if (strncasecmp(str, "true", 4) == 0) {
+	if (strncasecmp(str, SQL_TOKEN_TRUE, strlen(SQL_TOKEN_TRUE)) == 0) {
 		*result = true;
 		str += 4;
-	} else if (strncasecmp(str, "false", 5) == 0) {
+	} else if (strncasecmp(str, SQL_TOKEN_FALSE,
+			       strlen(SQL_TOKEN_FALSE)) == 0) {
 		*result = false;
 		str += 5;
 	} else {
@@ -753,7 +755,7 @@ sqlVdbeMemCast(Mem * pMem, enum field_type type)
 		assert(type == FIELD_TYPE_STRING);
 		assert(MEM_Str == (MEM_Blob >> 3));
 		if ((pMem->flags & MEM_Bool) != 0) {
-			const char *str_bool = pMem->u.b ? "true" : "false";
+			const char *str_bool = SQL_TOKEN_BOOLEAN(pMem->u.b);
 			sqlVdbeMemSetStr(pMem, str_bool, strlen(str_bool), 1,
 					 SQL_TRANSIENT);
 			return 0;
diff --git a/test/sql/boolean.result b/test/sql/boolean.result
index 191fa33f3..e5a00696b 100644
--- a/test/sql/boolean.result
+++ b/test/sql/boolean.result
@@ -161,7 +161,7 @@ SELECT s FROM ts WHERE s IN (true, 1, 'abcd');
 INSERT INTO ts VALUES (true, 12345);
  | ---
  | - null
- | - 'Type mismatch: can not convert true to integer'
+ | - 'Type mismatch: can not convert TRUE to integer'
  | ...
 

  	... and tens of similar changes in the same file ...

diff --git a/test/sql/boolean.test.sql b/test/sql/boolean.test.sql
index 63eb505c5..65a830349 100644
--- a/test/sql/boolean.test.sql
+++ b/test/sql/boolean.test.sql
@@ -129,7 +129,7 @@ INSERT INTO t3 VALUES (4, false)
 -- Check CAST from BOOLEAN to the other types.
 SELECT cast(true AS INTEGER), cast(false AS INTEGER);
 SELECT cast(true AS NUMBER), cast(false AS NUMBER);
--- gh-4462: ensure that text representation is lowercase.
+-- gh-4462: ensure that text representation is uppercase.
 SELECT cast(true AS TEXT), cast(false AS TEXT);
 SELECT cast(true AS BOOLEAN), cast(false AS BOOLEAN);
 
diff --git a/test/sql/types.result b/test/sql/types.result
index 1bb8b0cec..37350f034 100644
--- a/test/sql/types.result
+++ b/test/sql/types.result
@@ -1232,7 +1232,7 @@ box.execute("INSERT INTO t VALUES(1, 1.123);")
 box.execute("INSERT INTO t VALUES(1, true);")
 ---
 - null
-- 'Type mismatch: can not convert true to varbinary'
+- 'Type mismatch: can not convert TRUE to varbinary'
 ...
 box.execute("INSERT INTO t VALUES(1, 'asd');")
 ---
@@ -1464,7 +1464,7 @@ box.execute("SELECT CAST(1.123 AS VARBINARY);")
 box.execute("SELECT CAST(true AS VARBINARY);")
 ---
 - null
-- 'Type mismatch: can not convert true to varbinary'
+- 'Type mismatch: can not convert TRUE to varbinary'
 ...
 box.execute("SELECT CAST('asd' AS VARBINARY);")
 ---

=======================================================================

New commit message:

    sql: implicit boolean cast to text returns uppercase
    
    Explicit cast uses uppercase, and the patch makes the
    implicit cast the same.
    
    Upper case is the standard according to SQL standard
    2011, cast specification 6.13, general rules 11.e:
    
        General rules
    
        11) If TD is variable-length character string or
            large object character string, then let MLTD
            be the maximum length in characters of TD.
    
            e) If SD (source type) is boolean, then Case:
    
                i)   If SV is True and MLTD is not less
                     than 4, then TV is 'TRUE'.
    
                ii)  If SV is False and MLTD is not less
                     than 5, then TV is 'FALSE'.
    
                iii) Otherwise, an exception condition is
                     raised: data exception — invalid
                     character value for cast.
    
    Part of #4462

> As for implicit cast - it is allowed neither in ANSI nor in Tarantool SQL.
> However, some functions (like length or group_concat) anyway provide implicit
> conversion from boolean to string. Why not simply disallow that?

We will disallow. But we have different tickets for that. Goal of this commit
and this ticket is to stabilize what we have at this moment until we drop
implicit casts. Not only boolean related, but all of them.

> Earlier I suggested to remove all dispatching logic from built-ins
> implementations and instead generate OP_ApplyType with function's argument
> and its assumed type. AfAIR Mergen faced some problems with that, but I
> believe it is likely to be most general and correct solution.
> 

Probably it is not a place to discuss it, but are you sure it is a good idea
to emit OP_ApplyType for each argument of each function before it is called?
This is one of the main reasons why we have implicit casts: now functions
internally transform types just like OP_ApplyType does. They transform
strings to numbers, and back. OP_ApplyType does the same, no? I was thinking
that on the contrary we are going to reduce usage of OP_ApplyType, as well
as drop manual casts from functions.

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

* Re: [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper
  2019-10-27 21:35 [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Vladislav Shpilevoy
                   ` (2 preceding siblings ...)
  2019-10-27 21:35 ` [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere Vladislav Shpilevoy
@ 2019-10-30 23:28 ` Nikita Pettik
  3 siblings, 0 replies; 10+ messages in thread
From: Nikita Pettik @ 2019-10-30 23:28 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches, tarantool-patches

On 27 Oct 22:35, Vladislav Shpilevoy wrote:
> The patchset contains 3 independent commits fixing some minor
> things in SQL.
> 
> The commit messages below speak for themselves, everything is
> trivial.

Pushed first and second patches. I will push the last one at the end of
week if Kirill doesn't look at it earlier.
 
> This patchset is mostly about problems mentioned in #4462, but
> does not close it. Because I don't know to fix the last problem
> yet, and don't know whether I will do it.
> 
> Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-4462-sql-boolean-bugs
> Issue: https://github.com/tarantool/tarantool/issues/4462
> 

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

* Re: [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere
  2019-10-28 21:45     ` Vladislav Shpilevoy
@ 2019-11-07 12:40       ` Nikita Pettik
  0 siblings, 0 replies; 10+ messages in thread
From: Nikita Pettik @ 2019-11-07 12:40 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches, tarantool-patches

On 28 Oct 22:45, Vladislav Shpilevoy wrote:
> Thanks for the review!
> 
> On 28/10/2019 15:23, Nikita Pettik wrote:
> > On 27 Oct 22:35, Vladislav Shpilevoy wrote:
> >> Type was displayed in error messages, was returned in
> >> meta headers, and a type string is a result of
> >> typeof() SQL function.
> >>
> >> Typeof() always returns lower case type string; meta
> >> contained upper case type; error messages contained
> >> both.
> >>
> >> It was necessary to choose one case for everything,
> >> and the lower one was chosen. It allows not to break
> >> typeof() function which actually might be used by
> >> someone.
> >>
> >> Part of #4462
> > 
> > CI status is negative: sql/bind.test.lua fails. Please, update result file.
> 
> Fixed.
> 
> > The rest is OK as trivial. I want Kirill to look at this change and give
> > explicit ack for this change. In the latter case, it can be pushed out of order.
> >

Pushed to master.
 

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

end of thread, other threads:[~2019-11-07 12:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-27 21:35 [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Vladislav Shpilevoy
2019-10-27 21:35 ` [Tarantool-patches] [PATCH 1/3] sql: LENGTH function accepts boolean Vladislav Shpilevoy
2019-10-27 21:35 ` [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase Vladislav Shpilevoy
2019-10-28 14:08   ` Nikita Pettik
2019-10-28 21:48     ` Vladislav Shpilevoy
2019-10-27 21:35 ` [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere Vladislav Shpilevoy
2019-10-28 14:23   ` Nikita Pettik
2019-10-28 21:45     ` Vladislav Shpilevoy
2019-11-07 12:40       ` Nikita Pettik
2019-10-30 23:28 ` [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Nikita Pettik

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