Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org, Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] [PATCH v2 0/3] Change collation compatibility rules according to ANSI SQL
Date: Tue, 13 Nov 2018 03:07:23 +0300	[thread overview]
Message-ID: <cover.1542066357.git.korablev@tarantool.org> (raw)

This patch-set introduces rules for collation compatibility in order to
restrict usage of different collations within one comparison.
Originally, SQLite uses doubtful approach: if collations of LHS and RHS
can not be used together, then collation of LHS is chosen.  Such
behaviour quite misleading and results in the fact that swap of LHS and
RHS values may change result of operation.  We've decided to add
restrictions on collations of LHS and RHS to disallow messing different
collations as it is stated in ANSI SQL.

Changes in v2:

Instead of using surrogate ids for "binary" and "none" collations,
now real ones are added to _collation space. They also come with
new collation type - binary. It simply uses memcmp as a collation
rule. For details see second patch in series.

Minor fixes:

- Make collations_are_compatible() be collations_check_compatibility()
  and process diag_set() right there;
- Clean-up debug asserts.

Nikita Pettik (3):
  sql: do not add explicit <COLLATE "BINARY"> clause
  Introduce "none" and "binary" collations
  sql: change collation compatibility rules

 src/box/alter.cc                  |  13 ++++-
 src/box/bootstrap.snap            | Bin 1888 -> 1911 bytes
 src/box/coll_id.c                 |   1 -
 src/box/errcode.h                 |   2 +
 src/box/field_def.c               |   2 +-
 src/box/key_def.c                 |  18 +++---
 src/box/key_def.h                 |   6 --
 src/box/lua/space.cc              |   2 +-
 src/box/lua/upgrade.lua           |   2 +
 src/box/sql.c                     |  10 ++--
 src/box/sql/build.c               |   2 +-
 src/box/sql/callback.c            |  19 +++++--
 src/box/sql/expr.c                |  73 ++++++++++++++++++------
 src/box/sql/fkey.c                |   2 -
 src/box/sql/func.c                |   2 +-
 src/box/sql/select.c              | 117 ++++++++++++++++++++------------------
 src/box/sql/sqliteInt.h           |  28 ++++++++-
 src/box/sql/where.c               |  15 +++--
 src/box/sql/whereexpr.c           |  38 ++++++-------
 src/box/tuple_format.c            |   4 +-
 src/coll.c                        |  52 ++++++++++++++---
 src/coll_def.c                    |   2 +-
 src/coll_def.h                    |   1 +
 test/box/ddl.result               |  20 ++++---
 test/box/misc.result              |   2 +
 test/box/net.box.result           |   2 +-
 test/sql-tap/collation.test.lua   |  12 ++--
 test/sql-tap/distinct.test.lua    |   2 +-
 test/sql-tap/e_select1.test.lua   |  12 ++--
 test/sql-tap/in3.test.lua         |   2 +-
 test/sql-tap/in4.test.lua         |   2 +-
 test/sql-tap/index3.test.lua      |   2 +-
 test/sql-tap/join.test.lua        |   2 +-
 test/sql-tap/tkt3493.test.lua     |   4 +-
 test/sql-tap/transitive1.test.lua |   4 +-
 test/sql-tap/where2.test.lua      |   2 +-
 test/sql-tap/with1.test.lua       |   2 +-
 test/sql/collation.result         |  90 +++++++++++++++++++++++++++++
 test/sql/collation.test.lua       |  36 ++++++++++++
 39 files changed, 427 insertions(+), 180 deletions(-)

-- 
2.15.1

             reply	other threads:[~2018-11-13  0:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13  0:07 Nikita Pettik [this message]
2018-11-13  0:07 ` [tarantool-patches] [PATCH v2 1/3] sql: do not add explicit <COLLATE "BINARY"> clause Nikita Pettik
2018-11-13  0:07 ` [tarantool-patches] [PATCH v2 2/3] Introduce "none" and "binary" collations Nikita Pettik
2018-11-13 12:02   ` [tarantool-patches] " Vladislav Shpilevoy
2018-11-13 22:37     ` n.pettik
2018-11-14 11:52       ` Vladislav Shpilevoy
2018-11-14 20:59         ` n.pettik
2018-11-15 11:04           ` Vladislav Shpilevoy
2018-11-13  0:07 ` [tarantool-patches] [PATCH v2 3/3] sql: change collation compatibility rules Nikita Pettik
2018-11-13 12:02   ` [tarantool-patches] " Vladislav Shpilevoy
2018-11-13 22:37     ` n.pettik
2018-11-15 11:24 ` [tarantool-patches] Re: [PATCH v2 0/3] Change collation compatibility rules according to ANSI SQL Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1542066357.git.korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH v2 0/3] Change collation compatibility rules according to ANSI SQL' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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