Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches]  26 [PATCH v2 1/1] netbox: show is_nullable and collation fields
@ 2018-03-26 17:11 Kirill Shcherbatov
  0 siblings, 0 replies; only message in thread
From: Kirill Shcherbatov @ 2018-03-26 17:11 UTC (permalink / raw)
  To: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 4260 bytes --]

Fixes #3256
---

Issue:  https://github.com/tarantool/tarantool/issues/3256
Branch:  https://github.com/tarantool/tarantool/compare/gh-3256-net-box-nullable-collation-options-output

 src/box/lua/net_box.lua | 6 ++++-
 test/box/net.box.result | 65 +++++++++++++++++++++++++++++++++++++++++++++++
 test/box/net.box.test.lua | 24 +++++++++++++++++
 3 files changed, 94 insertions(+), 1 deletion(-)

diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index a6a8648..d37032f 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -895,12 +895,16 @@ function remote_methods:_install_schema(schema_version, spaces, indices)
             end
         else
             for k = 1, #index[PARTS] do
+ local pknullable = index[PARTS][k].is_nullable or false
+ local pkcollationid = index[PARTS][k].collation
                 local pktype = index[PARTS][k][2] or index[PARTS][k].type
                 local pkfield = index[PARTS][k][1] or index[PARTS][k].field
 
                 local pk = {
                     type = pktype,
- fieldno = pkfield + 1
+ fieldno = pkfield + 1,
+ collation_id = pkcollationid,
+ is_nullable = pknullable
                 }
                 idx.parts[k] = pk
             end
diff --git a/test/box/net.box.result b/test/box/net.box.result
index 6150ad3..c423c13 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -1308,15 +1308,19 @@ c.space.test:select{}
 c.space.test.index.primary.parts
 ---
 - - type: unsigned
+ is_nullable: false
     fieldno: 1
 ...
 c.space.test.index.covering.parts
 ---
 - - type: unsigned
+ is_nullable: false
     fieldno: 1
   - type: string
+ is_nullable: false
     fieldno: 3
   - type: unsigned
+ is_nullable: false
     fieldno: 2
 ...
 box.space.test:drop()
@@ -1979,3 +1983,64 @@ box.schema.user.revoke('guest','read,write,execute','universe')
 space:drop()
 ---
 ...
+--
+-- gh-3256 net.box is_nullable and collation options output
+--
+space = box.schema.create_space('test')
+---
+...
+box.schema.user.grant('guest','read,write,execute','space', 'test')
+---
+...
+pk = space:create_index('pk')
+---
+...
+sk = space:create_index('sk', {parts = {{2, 'unsigned', is_nullable = true}}})
+---
+...
+c = net:connect(box.cfg.listen)
+---
+...
+c.space.test.index.sk.parts
+---
+- - type: unsigned
+ is_nullable: true
+ fieldno: 2
+...
+c:close()
+---
+...
+space:drop()
+---
+...
+space = box.schema.create_space('test')
+---
+...
+box.schema.user.grant('guest','read,write,execute','space', 'test')
+---
+...
+box.internal.collation.create('test', 'ICU', 'ru-RU')
+---
+...
+sk = space:create_index('sk', { type = 'tree', parts = {{1, 'str', collation = 'test'}}, unique = true })
+---
+...
+c = net:connect(box.cfg.listen)
+---
+...
+c.space.test.index.sk.parts
+---
+- - type: string
+ is_nullable: false
+ collation_id: 3
+ fieldno: 1
+...
+c:close()
+---
+...
+box.internal.collation.drop('test')
+---
+...
+space:drop()
+---
+...
diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua
index c7541ed..fe45721 100644
--- a/test/box/net.box.test.lua
+++ b/test/box/net.box.test.lua
@@ -798,3 +798,27 @@ c.space.test.index.test_index ~= nil
 box.schema.user.revoke('guest','read,write,execute','universe')
 
 space:drop()
+
+
+--
+-- gh-3256 net.box is_nullable and collation options output
+--
+
+space = box.schema.create_space('test')
+box.schema.user.grant('guest','read,write,execute','space', 'test')
+pk = space:create_index('pk')
+sk = space:create_index('sk', {parts = {{2, 'unsigned', is_nullable = true}}})
+c = net:connect(box.cfg.listen)
+c.space.test.index.sk.parts
+c:close()
+space:drop()
+
+space = box.schema.create_space('test')
+box.schema.user.grant('guest','read,write,execute','space', 'test')
+box.internal.collation.create('test', 'ICU', 'ru-RU')
+sk = space:create_index('sk', { type = 'tree', parts = {{1, 'str', collation = 'test'}}, unique = true })
+c = net:connect(box.cfg.listen)
+c.space.test.index.sk.parts
+c:close()
+box.internal.collation.drop('test')
+space:drop()
\ No newline at end of file
-- 
2.7.4

[-- Attachment #2: Type: text/html, Size: 46539 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-26 17:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-26 17:11 [tarantool-patches] 26 [PATCH v2 1/1] netbox: show is_nullable and collation fields Kirill Shcherbatov

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