@@ -309,6 +309,7 @@ Below is a list of all ``box.space`` functions and members.
309
309
| parts | field-numbers + types | {field_no, ``'unsigned' `` or | ``{1, 'unsigned'} `` |
310
310
| | | ``'string' `` or ``'integer' `` or | |
311
311
| | | ``'number' `` or ``'boolean' `` or | |
312
+ | | | ``'decimal' `` or | |
312
313
| | | ``'varbinary' `` or | |
313
314
| | | ``'array' `` or ``'scalar' ``, | |
314
315
| | | and optional collation or | |
@@ -375,8 +376,8 @@ Below is a list of all ``box.space`` functions and members.
375
376
376
377
**Details about index field types: **
377
378
378
- The eight index field types (unsigned | string | integer | number |
379
- boolean | varbinary | array | scalar) differ depending on what values are allowed, and
379
+ The nine index field types (unsigned | string | integer | number |
380
+ boolean | decimal | varbinary | array | scalar) differ depending on what values are allowed, and
380
381
what index types are allowed.
381
382
382
383
* **unsigned **: unsigned integers between 0 and 18446744073709551615,
@@ -392,10 +393,13 @@ Below is a list of all ``box.space`` functions and members.
392
393
vinyl TREE indexes.
393
394
* **number **: integers between -9223372036854775808 and 18446744073709551615,
394
395
single-precision floating point numbers, or double-precision floating
395
- point numbers. Legal in memtx TREE or HASH indexes, and in vinyl TREE
396
+ point numbers, or exact numbers . Legal in memtx TREE or HASH indexes, and in vinyl TREE
396
397
indexes.
397
398
* **boolean **: true or false. Legal in memtx TREE or HASH indexes, and in
398
399
vinyl TREE indexes.
400
+ * **decimal **: exact number returned from a function in the
401
+ :ref: `decimal <decimal >` module. Legal in memtx TREE or HASH indexes,
402
+ and in vinyl TREE indexes.
399
403
* **varbinary **: any set of octets, up to the :ref: `maximum length
400
404
<limitations_bytes_in_index_key>`. Legal in
401
405
memtx TREE or HASH indexes, and in vinyl TREE indexes.
@@ -406,8 +410,9 @@ Below is a list of all ``box.space`` functions and members.
406
410
booleans (true or false), or integers between
407
411
-9223372036854775808 and 18446744073709551615, or single-precision
408
412
floating point numbers, or double-precison floating-point numbers, or
409
- strings. When there is a mix of types, the key order is: null, then
410
- booleans, then numbers, then strings. Legal in memtx TREE or
413
+ exact numbers, or strings, or (varbinary) byte arrays.
414
+ When there is a mix of types, the key order is: null, then
415
+ booleans, then numbers, then strings, then byte arrays. Legal in memtx TREE or
411
416
HASH indexes, and in vinyl TREE indexes.
412
417
413
418
Additionally, `nil ` is allowed with any index field type if
@@ -450,11 +455,17 @@ Below is a list of all ``box.space`` functions and members.
450
455
| | single-precision | | |
451
456
| | floating point numbers, | | |
452
457
| | double-precision | | |
453
- | | floating point numbers | | |
458
+ | | floating point numbers, | | |
459
+ | | exact (decimal) numbers | | |
454
460
+------------------+---------------------------+---------------------------------------+-----------------------+
455
461
| **boolean ** | true or false | memtx TREE or HASH indexes, |br | | false |br | |
456
462
| | | vinyl TREE indexes | true |
457
463
+------------------+---------------------------+---------------------------------------+-----------------------+
464
+ | **decimal ** | exact numbers returned by | memtx TREE or HASH indexes, |br | | decimal.new(1.2) |br | |
465
+ | | a function in the | vinyl TREE indexes | |
466
+ | | :ref: `decimal <decimal >` | | |
467
+ | | module | | |
468
+ +------------------+---------------------------+---------------------------------------+-----------------------+
458
469
| **array ** | array of integers between | memtx RTREE indexes | {10, 11} |br | |
459
470
| | -9223372036854775808 and | | {3, 5, 9, 10} |
460
471
| | 9223372036854775807 | | |
@@ -790,7 +801,7 @@ Below is a list of all ``box.space`` functions and members.
790
801
have the same name;
791
802
* the ``type `` value may be any of those allowed for
792
803
:ref: `indexed fields <index-box_indexed-field-types >`:
793
- unsigned | string | varbinary | integer | number | boolean | array | scalar
804
+ unsigned | string | varbinary | integer | number | boolean | decimal | array | scalar
794
805
(the same as the requirement in
795
806
:ref: `"Options for space_object:create_index" <box_space-create_index-options >`);
796
807
* the optional ``is_nullable `` value may be either ``true `` or ``false ``
@@ -863,31 +874,60 @@ Below is a list of all ``box.space`` functions and members.
863
874
864
875
.. code-block :: tarantoolsession
865
876
877
+ tarantool> decimal = require('decimal')
878
+ ---
879
+ ...
866
880
tarantool> box.schema.space.create('t')
867
- --- ...
881
+ ---
882
+ - engine: memtx
883
+ before_replace: 'function: 0x40650f60'
884
+ on_replace: 'function: 0x406a3eb8'
885
+ ck_constraint: []
886
+ field_count: 0
887
+ temporary: false
888
+ index: []
889
+ is_local: false
890
+ enabled: false
891
+ name: t
892
+ id: 512
893
+ - created
894
+ ...
868
895
tarantool> box.space.t:format({{name='1',type='any'},
869
- > {name='2',type='unsigned'},
870
- > {name='3',type='string'},
871
- > {name='4',type='number'},
872
- > {name='5',type='integer'},
873
- > {name='6',type='boolean'},
874
- > {name='7',type='scalar'},
875
- > {name='8',type='array'},
876
- > {name='9',type='map'}})
877
- --- ...
896
+ > {name='2',type='unsigned'},
897
+ > {name='3',type='string'},
898
+ > {name='4',type='number'},
899
+ > {name='5',type='integer'},
900
+ > {name='6',type='boolean'},
901
+ > {name='7',type='decimal'},
902
+ > {name='8',type='scalar'},
903
+ > {name='9',type='array'},
904
+ > {name='10',type='map'}})
905
+ ---
906
+ ...
878
907
tarantool> box.space.t:create_index('i',{parts={2,'unsigned'}})
879
- --- ...
880
- tarantool> box.space.t:insert{{'a'}, -- any
881
- > 1, -- unsigned
882
- > 'W?', -- string
883
- > 5.5, -- number
884
- > -0, -- integer
885
- > true, -- boolean
886
- > true, -- scalar
887
- > {{'a'}}, -- array
888
- > {val=1}} -- map
889
908
---
890
- - [['a'], 1, 'W?', 5.5, 0, true, true, [['a']], {'val': 1}]
909
+ - unique: true
910
+ parts:
911
+ - type: unsigned
912
+ is_nullable: false
913
+ fieldno: 2
914
+ id: 0
915
+ space_id: 512
916
+ type: TREE
917
+ name: i
918
+ ...
919
+ tarantool> box.space.t:insert{{'a'}, -- any
920
+ > 1, -- unsigned
921
+ > 'W?', -- string
922
+ > 5.5, -- number
923
+ > -0, -- integer
924
+ > true, -- boolean
925
+ > decimal.new(1.2), -- decimal
926
+ > true, -- scalar
927
+ > {{'a'}}, -- array
928
+ > {val=1}} -- map
929
+ ---
930
+ - [['a'], 1, 'W?', 5.5, 0, true, 1.2, true, [['a']], {'val': 1}]
891
931
...
892
932
893
933
Names specified with the format clause can be used in
0 commit comments