Skip to content

Fixes gh-842, gh-914, gh-919, gh-958 by onvember #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 61 additions & 61 deletions doc/book/box/box_space.rst

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions doc/book/box/data_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ field #1 of each tuple:

.. code-block:: tarantoolsession

tarantool> i = s:create_index('primary', {type = 'hash', parts = {1, 'unsigned'}})
tarantool> i = s:create_index('primary', {type = 'hash', parts = {field = 1, type = 'unsigned'}})

The effect is that, for all tuples in space 'tester', field #1 must exist and
must contain an unsigned integer.
Expand All @@ -107,7 +107,7 @@ of each tuple:

.. code-block:: tarantoolsession

tarantool> i = s:create_index('secondary', {type = 'tree', parts = {2, 'string'}})
tarantool> i = s:create_index('secondary', {type = 'tree', parts = {field = 2, type = 'string'}})

The effect is that, for all tuples in space 'tester', field #2 must exist and
must contain a string.
Expand Down Expand Up @@ -389,7 +389,7 @@ As an example, take some Russian words:

.. code-block:: tarantoolsession

tarantool> box.space.T:create_index('I', {parts = {{1,'str', collation='unicode'}}})
tarantool> box.space.T:create_index('I', {parts = {{field = 1, type = 'str', collation='unicode'}}})
...
tarantool> box.space.T.index.I:select()
---
Expand All @@ -412,7 +412,7 @@ As an example, take some Russian words:

.. code-block:: tarantoolsession

tarantool> box.space.T:create_index('I', {parts = {{1,'str', collation='unicode_ci'}}})
tarantool> box.space.T:create_index('I', {parts = {{field = 1, type ='str', collation='unicode_ci'}}})
...
tarantool> box.space.S.index.I:select()
---
Expand Down Expand Up @@ -841,7 +841,7 @@ The following SELECT variations exist:

tarantool> box.schema.space.create('bitset_example')
tarantool> box.space.bitset_example:create_index('primary')
tarantool> box.space.bitset_example:create_index('bitset',{unique=false,type='BITSET', parts={2,'unsigned'}})
tarantool> box.space.bitset_example:create_index('bitset',{unique=false,type='BITSET', parts={field = 2, type = 'unsigned'}})
tarantool> box.space.bitset_example:insert{1,1}
tarantool> box.space.bitset_example:insert{2,4}
tarantool> box.space.bitset_example:insert{3,7}
Expand All @@ -865,7 +865,7 @@ The following SELECT variations exist:

tarantool> box.schema.space.create('rtree_example')
tarantool> box.space.rtree_example:create_index('primary')
tarantool> box.space.rtree_example:create_index('rtree',{unique=false,type='RTREE', parts={2,'ARRAY'}})
tarantool> box.space.rtree_example:create_index('rtree',{unique=false,type='RTREE', parts={field = 2, type = 'ARRAY'}})
tarantool> box.space.rtree_example:insert{1, {3, 5, 9, 10}}
tarantool> box.space.rtree_example:insert{2, {10, 11}}
tarantool> box.space.rtree_example.index.rtree:select({4, 7, 5, 9}, {iterator = 'GT'})
Expand Down
21 changes: 11 additions & 10 deletions doc/book/sql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
| E021-03 | Character literals | ``insert into t45 values ('');`` | Okay, and the bad practice of accepting ""'s for |
| | | | character literals is avoided. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E021-04 | CHARACTER_LENGTH function | ``select character_length(s1) from t;`` | Fail. There is no such function. There is a function |
| | | | LENGTH(), which is okay. |
| E021-04 | :ref:`CHARACTER_LENGTH <sql_function_length>` | ``select character_length(s1) from t;`` | Fail. There is no such function. There is a function |
| | function | | LENGTH(), which is okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E021-05 | OCTET_LENGTH | ``select octet_length(s1) from t;`` | Fail. There is no such function. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
Expand All @@ -71,7 +71,8 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E021-07 | Character concatenation | ``select 'a' || 'b' from t;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E021-08 | UPPER and LOWER functions | ``select upper('a'),lower('B') from t;`` | Okay. |
| E021-08 | :ref:`UPPER <sql_function_upper>` and | ``select upper('a'),lower('B') from t;`` | Okay. |
| | :ref:`LOWER <sql_function_lower>` functions | | SUBSTR(x,n,n) which is okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E021-09 | TRIM function | ``select trim('a ') from t;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
Expand Down Expand Up @@ -99,14 +100,14 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E051-01 | SELECT DISTINCT | ``select distinct s1 from t;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E051-02 | GROUP BY clause | ``select distinct s1 from t group by s1;`` | Okay. |
| E051-02 | :ref:`GROUP BY <sql_group_by>` clause | ``select distinct s1 from t group by s1;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E051-04 | GROUP BY can contain columns not in select | ``select s1 from t group by lower(s1);`` | Okay. |
| | list | | |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E051-05 | Select list items can be renamed | ``select s1 as K from t order by K;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E051-06 | HAVING clause | ``select count(*) from t having count(*) > 0;`` | Okay. GROUP BY is not mandatory before HAVING. |
| E051-06 | :ref:`HAVING <sql_having>` clause | ``select count(*) from t having count(*) > 0;`` | Okay. GROUP BY is not mandatory before HAVING. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E051-07 | Qualified * in select list | ``select t.* from t;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
Expand Down Expand Up @@ -185,15 +186,15 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E091 | Set functions |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E091-01 | AVG | ``select avg(s1) from t7;`` | Fail. No warning that nulls were eliminated. |
| E091-01 | :ref:`AVG <sql_aggregate_avg>` | ``select avg(s1) from t7;`` | Fail. No warning that nulls were eliminated. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E091-02 | COUNT | ``select count(*) from t7 where s1 > 0;`` | Okay. |
| E091-02 | :ref:`COUNT <sql_aggregate_count_row>` | ``select count(*) from t7 where s1 > 0;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E091-03 | MAX | ``select max(s1) from t7 where s1 > 0;`` | Okay. |
| E091-03 | :ref:`MAX <sql_aggregate_max>` | ``select max(s1) from t7 where s1 > 0;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E091-04 | MIN | ``select min(s1) from t7 where s1 > 0;`` | Okay. |
| E091-04 | :ref:`MIN <sql_aggregate_min>` | ``select min(s1) from t7 where s1 > 0;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E091-05 | SUM | ``select sum(1) from t7 where s1 > 0;`` | Okay. |
| E091-05 | :ref:`SUM <sql_aggregate_sum>` | ``select sum(1) from t7 where s1 > 0;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
| E091-06 | ALL quantifier | ``select sum(all s1) from t7 where s1 > 0;`` | Okay. |
+------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+
Expand Down
4 changes: 3 additions & 1 deletion doc/reference/reference_lua/string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ Below is a list of all additional ``string`` functions.
:param input-string: (string) the string to split
:param split-string: (string) the string to find within ``input-string``.
Default = space.
:param max: (integer) maximum number of delimiters to process counting from the beginning of the input string. Result will contain max + 1 parts maximum.
:param max: (integer) maximum number of delimiters to process counting
from the beginning of the input string. Result will
contain max + 1 parts maximum.

:Return: table of strings that were split from ``input-string``
:Rtype: table
Expand Down
2 changes: 0 additions & 2 deletions doc/reference/reference_lua/utf8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ there are comparison functions which understand the default ordering
for Cyrillic (Capital Letter Zhe Ж = Small Letter Zhe ж)
and Japanese (Hiragana A = Katakana A).

The module is fully built-in so ``require('utf8')`` is not necessary.

.. container:: table

.. rst-class:: left-align-column-1
Expand Down
43 changes: 37 additions & 6 deletions doc/reference/reference_sql/sql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,17 @@ definition.
Rules:

* A primary key is necessary; it can be specified with a table constraint
PRIMARY KEY.
``PRIMARY KEY``.
* There must be at least one column.
* When IF NOT EXISTS is specified, and there is already a table with the same
* When ``IF NOT EXISTS`` is specified, and there is already a table with the same
name, the statement is ignored.

Actions:

#. Tarantool evaluates each column definition and *table-constraint*,
and returns an error if any of the rules is violated.
#. Tarantool makes a new definition in the schema.
#. Tarantool makes new indexes for PRIMARY KEY or UNIQUE constraints.
#. Tarantool makes new indexes for ``PRIMARY KEY`` or ``UNIQUE`` constraints.
A unique index name is created automatically.
#. Tarantool effectively executes a ``COMMIT`` statement.

Expand Down Expand Up @@ -1717,21 +1717,29 @@ GROUP BY clause is omitted, then Tarantool assumes

NULLs are ignored for all aggregate functions except COUNT(*).

.. _sql_aggregate_avg:

``AVG([DISTINCT] expression)``
Return the average value of expression.

Example: :samp:`AVG({column1})`

.. _sql_aggregate_count_exp:

``COUNT([DISTINCT] expression)``
Return the number of occurrences of expression.

Example: :samp:`COUNT({column1})`

.. _sql_aggregate_count_row:

``COUNT(*)``
Return the number of occurrences of a row.

Example: :samp:`COUNT(*)`

.. _sql_aggregate_group_concat:

``GROUP_CONCAT(expression-1 [, expression-2])``
Return a list of *expression-1* values, separated
by commas if *expression-2* is omitted, or separated
Expand All @@ -1740,21 +1748,29 @@ NULLs are ignored for all aggregate functions except COUNT(*).

Example: :samp:`GROUP_CONCAT({column1})`

.. _sql_aggregate_max:

``MAX([DISTINCT] expression)``
Return the maximum value of expression.

Example: :samp:`MAX({column1})`

.. _sql_aggregate_min:

``MIN([DISTINCT] expression)``
Return the minimum value of expression.

Example: :samp:`MIN({column1})`

.. _sql_aggregate_sum:

``SUM([DISTINCT] expression)``
Return the sum of values of expression.

Example: :samp:`SUM({column1})`

.. _sql_aggregate_total:

``TOTAL([DISTINCT] expression)``
Return the sum of values of expression.

Expand Down Expand Up @@ -2665,7 +2681,7 @@ Syntax:
Return the value of the first non-NULL expression, or, if both
expression values are NULL, return NULL. Thus
``IFNULL(expression, expression)`` is the same as
``COALESCE(expression, expression)``.
:ref:`COALESCE(expression, expression) <sql_function_coalesce>`.

Example:
``IFNULL(NULL, 17)`` is 17
Expand Down Expand Up @@ -2696,6 +2712,21 @@ Examples:
* ``LENGTH(CHAR(0,65))`` is 2, '\0' does not mean 'end of string'.
* ``LENGTH(X'410041')`` is 3, X'...' byte sequences have type VARBINARY.

.. _sql_function_lower:

***********************************************
LOWER
***********************************************

Syntax:

:samp:`LOWER(string-expression)`

Return the expression, with upper-case characters converted to lower case.
This is the reverse of :ref:`UPPER(string-expression) <sql_function_upper>`.

Example: ``LOWER('-4ЩL')`` is '-4щl'.

.. _sql_function_nullif:

***********************************************
Expand Down Expand Up @@ -2787,7 +2818,7 @@ Syntax:

Return the Unicode code point value of the first character of **string-expression**.
If *string-expression* is empty, the return is NULL.
This is the reverse of CHAR(integer).
This is the reverse of :ref:`CHAR(integer) <sql_function_char>`.

Example: ``UNICODE('Щ')`` is 1065 (hexadecimal 0429).

Expand All @@ -2802,7 +2833,7 @@ Syntax:
:samp:`UPPER(string-expression)`

Return the expression, with lower-case characters converted to upper case.
This is the reverse of LOWER(string-expression).
This is the reverse of :ref:`LOWER(string-expression)<sql_function_lower>`.

Example: ``UPPER('-4щl')`` is '-4ЩL'.

Expand Down