* [tarantool-patches] [PATCH v1 1/1] sql: test to check that FK constraint does not fail
@ 2018-12-19 19:23 imeevma
2018-12-20 7:12 ` [tarantool-patches] " n.pettik
2018-12-21 7:40 ` Kirill Yukhin
0 siblings, 2 replies; 3+ messages in thread
From: imeevma @ 2018-12-19 19:23 UTC (permalink / raw)
To: korablev, tarantool-patches
The issue has been closed by commit 3eb796a. To check that
everything is working fine, a test has been added.
Closes #3644
---
https://github.com/tarantool/tarantool/issues/3644
https://github.com/tarantool/tarantool/tree/imeevma/gh-3644-foreign-key-update-with-unicode_ci
test/sql/collation.result | 64 +++++++++++++++++++++++++++++++++++++++++++++
test/sql/collation.test.lua | 24 +++++++++++++++++
2 files changed, 88 insertions(+)
diff --git a/test/sql/collation.result b/test/sql/collation.result
index 148a1a1..c69510f 100644
--- a/test/sql/collation.result
+++ b/test/sql/collation.result
@@ -261,3 +261,67 @@ box.session.su('admin')
box.schema.user.drop('tmp')
---
...
+-- gh-3644 Foreign key update fails with "unicode_ci".
+-- Check that foreign key update doesn't fail with "unicode_ci".
+box.sql.execute('CREATE TABLE t0 (s1 CHAR(5) COLLATE "unicode_ci" PRIMARY KEY);')
+---
+...
+box.sql.execute('CREATE TABLE t1 (s1 INT PRIMARY KEY, s0 CHAR(5) COLLATE "unicode_ci" REFERENCES t0(s1));')
+---
+...
+box.sql.execute("INSERT INTO t0 VALUES ('a');")
+---
+...
+box.sql.execute("INSERT INTO t1 VALUES (1,'a');")
+---
+...
+-- Should't fail.
+box.sql.execute("UPDATE t0 SET s1 = 'A';")
+---
+...
+box.sql.execute("SELECT * FROM t0;")
+---
+- - ['A']
+...
+box.sql.execute("SELECT * FROM t1;")
+---
+- - [1, 'a']
+...
+box.sql.execute("DROP TABLE t1;")
+---
+...
+box.sql.execute("DROP TABLE t0;")
+---
+...
+-- Check that foreign key update fails with default collation.
+box.sql.execute('CREATE TABLE t0 (s1 CHAR(5) PRIMARY KEY);')
+---
+...
+box.sql.execute('CREATE TABLE t1 (s1 INT PRIMARY KEY, s0 CHAR(5) REFERENCES t0(s1));')
+---
+...
+box.sql.execute("INSERT INTO t0 VALUES ('a');")
+---
+...
+box.sql.execute("INSERT INTO t1 VALUES (1,'a');")
+---
+...
+-- Should fail.
+box.sql.execute("UPDATE t0 SET s1 = 'A';")
+---
+- error: FOREIGN KEY constraint failed
+...
+box.sql.execute("SELECT * FROM t1;")
+---
+- - [1, 'a']
+...
+box.sql.execute("SELECT * FROM t0;")
+---
+- - ['a']
+...
+box.sql.execute("DROP TABLE t1;")
+---
+...
+box.sql.execute("DROP TABLE t0;")
+---
+...
diff --git a/test/sql/collation.test.lua b/test/sql/collation.test.lua
index ade3a69..4ad2d5e 100644
--- a/test/sql/collation.test.lua
+++ b/test/sql/collation.test.lua
@@ -102,3 +102,27 @@ box.session.su('tmp')
box.sql.execute("pragma collation_list")
box.session.su('admin')
box.schema.user.drop('tmp')
+
+-- gh-3644 Foreign key update fails with "unicode_ci".
+-- Check that foreign key update doesn't fail with "unicode_ci".
+box.sql.execute('CREATE TABLE t0 (s1 CHAR(5) COLLATE "unicode_ci" PRIMARY KEY);')
+box.sql.execute('CREATE TABLE t1 (s1 INT PRIMARY KEY, s0 CHAR(5) COLLATE "unicode_ci" REFERENCES t0(s1));')
+box.sql.execute("INSERT INTO t0 VALUES ('a');")
+box.sql.execute("INSERT INTO t1 VALUES (1,'a');")
+-- Should't fail.
+box.sql.execute("UPDATE t0 SET s1 = 'A';")
+box.sql.execute("SELECT * FROM t0;")
+box.sql.execute("SELECT * FROM t1;")
+box.sql.execute("DROP TABLE t1;")
+box.sql.execute("DROP TABLE t0;")
+-- Check that foreign key update fails with default collation.
+box.sql.execute('CREATE TABLE t0 (s1 CHAR(5) PRIMARY KEY);')
+box.sql.execute('CREATE TABLE t1 (s1 INT PRIMARY KEY, s0 CHAR(5) REFERENCES t0(s1));')
+box.sql.execute("INSERT INTO t0 VALUES ('a');")
+box.sql.execute("INSERT INTO t1 VALUES (1,'a');")
+-- Should fail.
+box.sql.execute("UPDATE t0 SET s1 = 'A';")
+box.sql.execute("SELECT * FROM t1;")
+box.sql.execute("SELECT * FROM t0;")
+box.sql.execute("DROP TABLE t1;")
+box.sql.execute("DROP TABLE t0;")
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tarantool-patches] Re: [PATCH v1 1/1] sql: test to check that FK constraint does not fail
2018-12-19 19:23 [tarantool-patches] [PATCH v1 1/1] sql: test to check that FK constraint does not fail imeevma
@ 2018-12-20 7:12 ` n.pettik
2018-12-21 7:40 ` Kirill Yukhin
1 sibling, 0 replies; 3+ messages in thread
From: n.pettik @ 2018-12-20 7:12 UTC (permalink / raw)
To: tarantool-patches; +Cc: Imeev Mergen
LGTM.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tarantool-patches] Re: [PATCH v1 1/1] sql: test to check that FK constraint does not fail
2018-12-19 19:23 [tarantool-patches] [PATCH v1 1/1] sql: test to check that FK constraint does not fail imeevma
2018-12-20 7:12 ` [tarantool-patches] " n.pettik
@ 2018-12-21 7:40 ` Kirill Yukhin
1 sibling, 0 replies; 3+ messages in thread
From: Kirill Yukhin @ 2018-12-21 7:40 UTC (permalink / raw)
To: tarantool-patches; +Cc: korablev
Hello,
On 19 Dec 22:23, imeevma@tarantool.org wrote:
> The issue has been closed by commit 3eb796a. To check that
> everything is working fine, a test has been added.
>
> Closes #3644
> ---
> https://github.com/tarantool/tarantool/issues/3644
> https://github.com/tarantool/tarantool/tree/imeevma/gh-3644-foreign-key-update-with-unicode_ci
I've checked the patch into 2.1 branch.
--
Regards, Kirill Yukhin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-21 7:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19 19:23 [tarantool-patches] [PATCH v1 1/1] sql: test to check that FK constraint does not fail imeevma
2018-12-20 7:12 ` [tarantool-patches] " n.pettik
2018-12-21 7:40 ` Kirill Yukhin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox