From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org,
Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v1 1/1] sql: fix assertion on invalid PK column name
Date: Thu, 12 Jul 2018 09:30:32 +0300 [thread overview]
Message-ID: <1741e4e16438af3e3cb88ecd84a64faf711ad661.1531376946.git.kshcherbatov@tarantool.org> (raw)
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
next reply other threads:[~2018-07-12 6:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-12 6:30 Kirill Shcherbatov [this message]
2018-07-12 8:54 ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-12 10:03 ` Kirill Shcherbatov
2018-07-12 10:28 ` Vladislav Shpilevoy
2018-07-13 6:54 ` 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=1741e4e16438af3e3cb88ecd84a64faf711ad661.1531376946.git.kshcherbatov@tarantool.org \
--to=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [tarantool-patches] [PATCH v1 1/1] sql: fix assertion on invalid PK column name' \
/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