From fcef3b26d0497f528dc7fbc7bc99d30dff2d7b7a Mon Sep 17 00:00:00 2001
From: Bulat Niatshin <niatshin@tarantool.org>
Date: Wed, 20 Dec 2017 15:53:02 +0300
Subject: [PATCH] sql: assign is_nullable property for each collumn

Assign is_nullable property for each column in order to fix all sql
tests after reverting MP_NIL comparators in previous commit.

Closes #3009
---
 src/box/sql.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/box/sql.c b/src/box/sql.c
index ae95b9270d..3511690ef9 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -1342,8 +1342,7 @@ int tarantoolSqlite3MakeTableFormat(Table *pTable, void *buf)
 
 	for (i = 0; i < n; i++) {
 		const char *t;
-
-		p = enc->encode_map(p, 2);
+		p = enc->encode_map(p, 3);
 		p = enc->encode_str(p, "name", 4);
 		p = enc->encode_str(p, aCol[i].zName, strlen(aCol[i].zName));
 		p = enc->encode_str(p, "type", 4);
@@ -1354,6 +1353,8 @@ int tarantoolSqlite3MakeTableFormat(Table *pTable, void *buf)
 				convertSqliteAffinity(aCol[i].affinity, aCol[i].notNull == 0);
 		}
 		p = enc->encode_str(p, t, strlen(t));
+		p = enc->encode_str(p, "is_nullable", 11);
+		p = enc->encode_bool(p, aCol[i].notNull == OE_None);
 	}
 	return (int)(p - base);
 }
@@ -1428,7 +1429,7 @@ int tarantoolSqlite3MakeIdxParts(SqliteIndex *pIndex, void *buf)
 			 */
 			assert(collation);
 		}
-		p = enc->encode_map(p, collation == NULL ? 2 : 3);
+		p = enc->encode_map(p, collation == NULL ? 3 : 4);
 		p = enc->encode_str(p, "type", sizeof("type")-1);
 		p = enc->encode_str(p, t, strlen(t));
 		p = enc->encode_str(p, "field", sizeof("field")-1);
@@ -1437,6 +1438,8 @@ int tarantoolSqlite3MakeIdxParts(SqliteIndex *pIndex, void *buf)
 			p = enc->encode_str(p, "collation", sizeof("collation")-1);
 			p = enc->encode_uint(p, collation->id);
 		}
+		p = enc->encode_str(p, "is_nullable", 11);
+		p = enc->encode_bool(p, aCol[col].notNull == OE_None);
 	}
 	return (int)(p - base);
 }
-- 
GitLab