From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id BD50326CC1 for ; Tue, 27 Mar 2018 12:36:02 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ene15ZlvKFCp for ; Tue, 27 Mar 2018 12:36:02 -0400 (EDT) Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 55CE325EF3 for ; Tue, 27 Mar 2018 12:36:02 -0400 (EDT) From: "n.pettik" Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_0665E24F-6727-43E1-AC4B-C9D1672FCDC9" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH] sql: correct confusing message Date: Tue, 27 Mar 2018 19:36:00 +0300 In-Reply-To: <1522166528-23387-1-git-send-email-hollow653@gmail.com> References: <1522166528-23387-1-git-send-email-hollow653@gmail.com> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Hollow Cc: tarantool-patches@freelists.org --Apple-Mail=_0665E24F-6727-43E1-AC4B-C9D1672FCDC9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 If you decided to send patch v2, you should specify it: git format-patch --subject-prefix=3D'PATCH v2=E2=80=99 Moreover, as a rule if you send patch v2, you should add brief change log. Overall, patch seems to be OK, except for very minor remark: please, deal with your IDE or text editor to avoid extra diffs due to wrong indentation. You can update remotely your branch and send only diff in reply to this message. > On 27 Mar 2018, at 19:02, N.Tatunov wrote: >=20 > From: Hollow >=20 > Required to fix the following message: >=20 > "- error: expressions prohibited in PRIMARY KEY and UNIQUE = constraints" >=20 > Currently this message appears even when user tries to CREATE > non-unique functional index which isn't concerned with the > following error message. Thus far the message was corrected > to the proper one. >=20 > Closes #3236 > --- >=20 > Branch: https://github.com/tarantool/tarantool > Issue: https://github.com/tarantool/tarantool/issues/3236 >=20 > src/box/sql/build.c | 8 +++---- > test/sql-tap/colname.test.lua | 4 ++-- > test/sql/message-func-indexes.result | 41 = ++++++++++++++++++++++++++++++++++ > test/sql/message-func-indexes.test.lua | 18 +++++++++++++++ > 4 files changed, 65 insertions(+), 6 deletions(-) > create mode 100644 test/sql/message-func-indexes.result > create mode 100644 test/sql/message-func-indexes.test.lua >=20 > diff --git a/src/box/sql/build.c b/src/box/sql/build.c > index dd0f45c..c7f6b3c 100644 > --- a/src/box/sql/build.c > +++ b/src/box/sql/build.c > @@ -1802,7 +1802,7 @@ emitNewSysSpaceSequenceRecord(Parse *pParse, int = space_id, const char reg_seq_id >=20 > /* 1. Space id */ > sqlite3VdbeAddOp2(v, OP_SCopy, space_id, first_col + 1); > -=09 > + =20 Still redundant diff. Please check it carefully and don=E2=80=99t hurry. > /* 2. Sequence id */ > sqlite3VdbeAddOp2(v, OP_IntCopy, reg_seq_id, first_col + 2); >=20 > @@ -2015,7 +2015,7 @@ sqlite3EndTable(Parse * pParse, /* Parse context = */ >=20 > sqlite3OpenTable(pParse, iCursor, = sys_space_sequence, > OP_OpenWrite); > - =09 > + =20 The same: redundant diff. > reg_space_seq_record =3D = emitNewSysSpaceSequenceRecord( > pParse, > iSpaceId, > @@ -3065,8 +3065,8 @@ sqlite3CreateIndex(Parse * pParse, /* All = information about this parse */ > pCExpr =3D sqlite3ExprSkipCollate(pListItem->pExpr); > if (pCExpr->op !=3D TK_COLUMN) { > sqlite3ErrorMsg(pParse, > - "expressions prohibited in = PRIMARY KEY and " > - "UNIQUE constraints"); > + "functional indexes aren't = supported " > + "in the current version"); > goto exit_create_index; > } else { > j =3D pCExpr->iColumn; > diff --git a/test/sql-tap/colname.test.lua = b/test/sql-tap/colname.test.lua > index 71010da..c96623e 100755 > --- a/test/sql-tap/colname.test.lua > +++ b/test/sql-tap/colname.test.lua > @@ -643,13 +643,13 @@ test:do_catchsql_test( > "colname-11.2", > [[CREATE TABLE t1(a, b, c, d, e,=20 > PRIMARY KEY(a), UNIQUE('b' COLLATE "unicode_ci" DESC));]], > - {1, "/expressions prohibited in PRIMARY KEY/"}) > + {1, "/functional indexes aren't supported in the current = version/"}) >=20 > test:execsql("create table table1(a primary key, b, c)") >=20 > test:do_catchsql_test( > "colname-11.3", > [[ CREATE INDEX t1c ON table1('c'); ]], > - {1, "/expressions prohibited in PRIMARY KEY/"}) > + {1, "/functional indexes aren't supported in the current = version/"}) >=20 > test:finish_test() > diff --git a/test/sql/message-func-indexes.result = b/test/sql/message-func-indexes.result > new file mode 100644 > index 0000000..797cf28 > --- /dev/null > +++ b/test/sql/message-func-indexes.result > @@ -0,0 +1,41 @@ > +test_run =3D require('test_run').new() > +--- > +... > +-- Creating tables. > +box.sql.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)") > +--- > +... > +box.sql.execute("CREATE TABLE t2(object INTEGER PRIMARY KEY, price = INTEGER, count INTEGER)") > +--- > +... > +-- Expressions that're supposed to create functional indexes > +-- should return certain message. > +box.sql.execute("CREATE INDEX i1 ON t1(a+1)") > +--- > +- error: functional indexes aren't supported in the current version > +... > +box.sql.execute("CREATE INDEX i2 ON t1(a)") > +--- > +... > +box.sql.execute("CREATE INDEX i3 ON t2(price + 100)") > +--- > +- error: functional indexes aren't supported in the current version > +... > +box.sql.execute("CREATE INDEX i4 ON t2(price)") > +--- > +... > +box.sql.execute("CREATE INDEX i5 ON t2(count + 1)") > +--- > +- error: functional indexes aren't supported in the current version > +... > +box.sql.execute("CREATE INDEX i6 ON t2(count * price)") > +--- > +- error: functional indexes aren't supported in the current version > +... > +-- Cleaning up. > +box.sql.execute("DROP TABLE t1") > +--- > +... > +box.sql.execute("DROP TABLE t2")=20 > +--- > +... > diff --git a/test/sql/message-func-indexes.test.lua = b/test/sql/message-func-indexes.test.lua > new file mode 100644 > index 0000000..fac715b > --- /dev/null > +++ b/test/sql/message-func-indexes.test.lua > @@ -0,0 +1,18 @@ > +test_run =3D require('test_run').new() > + > +-- Creating tables. > +box.sql.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)") > +box.sql.execute("CREATE TABLE t2(object INTEGER PRIMARY KEY, price = INTEGER, count INTEGER)") > + > +-- Expressions that're supposed to create functional indexes > +-- should return certain message. > +box.sql.execute("CREATE INDEX i1 ON t1(a+1)") > +box.sql.execute("CREATE INDEX i2 ON t1(a)") > +box.sql.execute("CREATE INDEX i3 ON t2(price + 100)") > +box.sql.execute("CREATE INDEX i4 ON t2(price)") > +box.sql.execute("CREATE INDEX i5 ON t2(count + 1)") > +box.sql.execute("CREATE INDEX i6 ON t2(count * price)") > + > +-- Cleaning up. > +box.sql.execute("DROP TABLE t1") > +box.sql.execute("DROP TABLE t2")=20 > --=20 > 2.7.4 >=20 >=20 --Apple-Mail=_0665E24F-6727-43E1-AC4B-C9D1672FCDC9 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
If you decided to send patch v2, you should = specify it:
git format-patch --subject-prefix=3D'PATCH= v2=E2=80=99

Moreover, as a rule if you send patch = v2,
you should add brief change log.

Overall, patch seems to = be OK, except for very minor remark:
please, deal = with your IDE or text editor to avoid extra diffs
due= to wrong indentation.

You can update remotely your branch and send only = diff
in reply to this message.

On = 27 Mar 2018, at 19:02, N.Tatunov <hollow653@gmail.com>= wrote:

From: Hollow <hollow653@gmail.com>

Required to fix the following message:

"- error: expressions prohibited in PRIMARY KEY and UNIQUE = constraints"

Currently this message appears = even when user tries to CREATE
non-unique functional index = which isn't concerned with the
following error message. = Thus far the message was corrected
to the proper one.

Closes #3236
---
Branch: https://github.com/tarantool/tarantool
Issue:= https://github.com/tarantool/tarantool/issues/3236

src/box/sql/build.c =             &n= bsp;      |  8 +++----
= test/sql-tap/colname.test.lua =          |  4 ++--
test/sql/message-func-indexes.result   | 41 = ++++++++++++++++++++++++++++++++++
= test/sql/message-func-indexes.test.lua | 18 +++++++++++++++
= 4 files changed, 65 insertions(+), 6 deletions(-)
create = mode 100644 test/sql/message-func-indexes.result
create = mode 100644 test/sql/message-func-indexes.test.lua

diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index dd0f45c..c7f6b3c 100644
--- = a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -1802,7 +1802,7 @@ emitNewSysSpaceSequenceRecord(Parse = *pParse, int space_id, const char reg_seq_id

= = /* 1. Space id  */
= sqlite3VdbeAddOp2(v, OP_SCopy, space_id, first_col + 1);
- =
+    

Still = redundant diff. Please check it carefully and don=E2=80=99t = hurry.

/* 2. Sequence id  */
= sqlite3VdbeAddOp2(v, OP_IntCopy, reg_seq_id, first_col + 2);

@@ -2015,7 +2015,7 @@ sqlite3EndTable(Parse * = pParse, = /* Parse context */

= sqlite3OpenTable(pParse, iCursor, sys_space_sequence,
= = = = = OP_OpenWrite);
-
+ =            

The = same: redundant diff.

reg_space_seq_record =3D = emitNewSysSpaceSequenceRecord(
= pParse,
iSpaceId,
@@ = -3065,8 +3065,8 @@ sqlite3CreateIndex(Parse * pParse, /* All = information about this parse */
pCExpr =3D = sqlite3ExprSkipCollate(pListItem->pExpr);
if = (pCExpr->op !=3D TK_COLUMN) {
= sqlite3ErrorMsg(pParse,
- = "expressions prohibited in PRIMARY KEY and "
- "UNIQUE = constraints");
+ "functional indexes aren't = supported "
+ "in the current version");
= = = goto exit_create_index;
} else = {
= = = j =3D pCExpr->iColumn;
diff --git = a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
index 71010da..c96623e 100755
--- = a/test/sql-tap/colname.test.lua
+++ = b/test/sql-tap/colname.test.lua
@@ -643,13 +643,13 @@ = test:do_catchsql_test(
=     "colname-11.2",
=     [[CREATE TABLE t1(a, b, c, d, e,
=       PRIMARY KEY(a), UNIQUE('b' COLLATE = "unicode_ci" DESC));]],
-    {1, = "/expressions prohibited in PRIMARY KEY/"})
+ =    {1, "/functional indexes aren't supported in the = current version/"})

test:execsql("create = table table1(a primary key, b, c)")

= test:do_catchsql_test(
=     "colname-11.3",
=     [[ CREATE INDEX t1c ON table1('c'); ]],
-    {1, "/expressions prohibited in PRIMARY = KEY/"})
+    {1, "/functional indexes = aren't supported in the current version/"})

= test:finish_test()
diff --git = a/test/sql/message-func-indexes.result = b/test/sql/message-func-indexes.result
new file mode = 100644
index 0000000..797cf28
--- = /dev/null
+++ b/test/sql/message-func-indexes.result
@@ -0,0 +1,41 @@
+test_run =3D = require('test_run').new()
+---
+...
+-- Creating tables.
+box.sql.execute("CREATE = TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)")
+---
+...
+box.sql.execute("CREATE TABLE t2(object = INTEGER PRIMARY KEY, price INTEGER, count INTEGER)")
+---+...
+-- Expressions that're supposed to = create functional indexes
+-- should return certain = message.
+box.sql.execute("CREATE INDEX i1 ON t1(a+1)")
+---
+- error: functional indexes aren't = supported in the current version
+...
+box.sql.execute("CREATE INDEX i2 ON t1(a)")
+---
+...
+box.sql.execute("CREATE = INDEX i3 ON t2(price + 100)")
+---
+- error: = functional indexes aren't supported in the current version
+...
+box.sql.execute("CREATE INDEX i4 ON = t2(price)")
+---
+...
+box.sql.execute("CREATE INDEX i5 ON t2(count + 1)")
+---
+- error: functional indexes aren't = supported in the current version
+...
+box.sql.execute("CREATE INDEX i6 ON t2(count * price)")
+---
+- error: functional indexes aren't = supported in the current version
+...
+-- = Cleaning up.
+box.sql.execute("DROP TABLE t1")
+---
+...
+box.sql.execute("DROP = TABLE t2")
+---
+...
diff = --git a/test/sql/message-func-indexes.test.lua = b/test/sql/message-func-indexes.test.lua
new file mode = 100644
index 0000000..fac715b
--- = /dev/null
+++ b/test/sql/message-func-indexes.test.lua
@@ -0,0 +1,18 @@
+test_run =3D = require('test_run').new()
+
+-- Creating = tables.
+box.sql.execute("CREATE TABLE t1(id INTEGER = PRIMARY KEY, a INTEGER)")
+box.sql.execute("CREATE TABLE = t2(object INTEGER PRIMARY KEY, price INTEGER, count INTEGER)")
+
+-- Expressions that're supposed to create = functional indexes
+-- should return certain message.
+box.sql.execute("CREATE INDEX i1 ON t1(a+1)")
+box.sql.execute("CREATE INDEX i2 ON t1(a)")
+box.sql.execute("CREATE INDEX i3 ON t2(price + 100)")
+box.sql.execute("CREATE INDEX i4 ON t2(price)")
+box.sql.execute("CREATE INDEX i5 ON t2(count + 1)")
+box.sql.execute("CREATE INDEX i6 ON t2(count * price)")
+
+-- Cleaning up.
+box.sql.execute("DROP TABLE t1")
+box.sql.execute("DROP TABLE t2")
--
2.7.4



= --Apple-Mail=_0665E24F-6727-43E1-AC4B-C9D1672FCDC9--