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 0EBC226D6B for ; Thu, 12 Jul 2018 02:30:38 -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 U2hLoMi8q1ww for ; Thu, 12 Jul 2018 02:30:37 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 5216226D6A for ; Thu, 12 Jul 2018 02:30:37 -0400 (EDT) From: Kirill Shcherbatov Subject: [tarantool-patches] [PATCH v1 1/1] sql: fix assertion on invalid PK column name Date: Thu, 12 Jul 2018 09:30:32 +0300 Message-Id: <1741e4e16438af3e3cb88ecd84a64faf711ad661.1531376946.git.kshcherbatov@tarantool.org> 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: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Kirill Shcherbatov Close #3522. --- https://github.com/tarantool/tarantool/compare/kshch/gh-3522-invalid-primary-key-column-name https://github.com/tarantool/tarantool/issues/3522 src/box/sql/build.c | 1 - test/sql/gh-2929-primary-key.result | 7 +++++++ test/sql/gh-2929-primary-key.test.lua | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/box/sql/build.c b/src/box/sql/build.c index e1d896e..5584d83 100644 --- a/src/box/sql/build.c +++ b/src/box/sql/build.c @@ -964,7 +964,6 @@ sqlite3AddPrimaryKey(Parse * pParse, /* Parsing context */ } } } - assert(pCol == &pTab->aCol[iCol]); if (nTerm == 1 && pCol != NULL && (pTab->def->fields[iCol].type == FIELD_TYPE_INTEGER) && sortOrder != SORT_ORDER_DESC) { diff --git a/test/sql/gh-2929-primary-key.result b/test/sql/gh-2929-primary-key.result index c238ed7..66a9b96 100644 --- a/test/sql/gh-2929-primary-key.result +++ b/test/sql/gh-2929-primary-key.result @@ -35,3 +35,10 @@ box.sql.execute("CREATE TABLE t5(a, b UNIQUE)") box.sql.execute("DROP TABLE t1") --- ... +-- +-- gh-3522: invalid primary key name +-- +box.sql.execute("CREATE TABLE tx (a INT, PRIMARY KEY (b));") +--- +- error: 'no such column: B' +... diff --git a/test/sql/gh-2929-primary-key.test.lua b/test/sql/gh-2929-primary-key.test.lua index 0a9395c..0e05354 100644 --- a/test/sql/gh-2929-primary-key.test.lua +++ b/test/sql/gh-2929-primary-key.test.lua @@ -16,3 +16,8 @@ box.sql.execute("CREATE TABLE t4(a, b)") box.sql.execute("CREATE TABLE t5(a, b UNIQUE)") box.sql.execute("DROP TABLE t1") + +-- +-- gh-3522: invalid primary key name +-- +box.sql.execute("CREATE TABLE tx (a INT, PRIMARY KEY (b));") -- 2.7.4