From: "n.pettik" <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: Imeev Mergen <imeevma@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v2 1/1] sql: cleanup on failed creation operation Date: Thu, 11 Oct 2018 18:09:01 +0300 [thread overview] Message-ID: <A38890C9-9974-4677-AFED-E6D0C3FBDD8F@tarantool.org> (raw) In-Reply-To: <a2f13106-5142-4f29-3c3c-fa49059f6767@tarantool.org> [-- Attachment #1: Type: text/plain, Size: 1570 bytes --] >>> +-- >>> +-- Check that _space, _index and _sequence have the same number of >>> +-- records. >>> +-- >>> +space_count == #box.space._space:select() >>> +index_count == #box.space._index:select() >>> +sequence_count == #box.space._sequence:select() >>> + >>> +box.schema.user.drop('tmp’) >> I see no tests involving FK constraints. Add them as well. >> > Added. > diff --git a/test/sql/drop-table.test.lua b/test/sql/drop-table.test.lua > index 1bc8894..f86e3d8 100644 > --- a/test/sql/drop-table.test.lua > +++ b/test/sql/drop-table.test.lua > > +-- Give user right to write in _sequence. Still have not enough > +-- rights to write in _fk_constraint. > +-- > +box.schema.user.grant('tmp', 'write', 'space', '_sequence') > +box.session.su('tmp') > + > +box.sql.execute('CREATE TABLE t3(a INTEGER PRIMARY KEY);') > +-- > +-- Error: user do not have rights to write in _fk_constraint. > +-- > +box.sql.execute('CREATE TABLE t4(x INTEGER PRIMARY KEY REFERENCES t3);') > +box.sql.execute('DROP TABLE t3;’) You misunderstood me a bit. I mean following test: fk_count = #box.space._fk_constraints:select() box.sql.execute('CREATE TABLE t4(x INTEGER PRIMARY KEY REFERENCES t3, a INT UNIQUE, c INT REFERENCES t3);’) Here creation of last FK fails - for instance due to type mismatch. Then, number of created FK constraints (and indexes) should be unchanged: fk_count == #box.space._fk_constraints:select() index_count == #box.space._fk_constraints:select() Note that FK constraints are created after indexes. [-- Attachment #2: Type: text/html, Size: 15578 bytes --]
next prev parent reply other threads:[~2018-10-11 15:09 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-09-07 19:04 [tarantool-patches] " imeevma 2018-09-18 16:18 ` [tarantool-patches] " Vladislav Shpilevoy 2018-09-20 18:02 ` Imeev Mergen 2018-09-20 19:14 ` Vladislav Shpilevoy 2018-09-22 9:21 ` Imeev Mergen 2018-09-24 10:44 ` Vladislav Shpilevoy 2018-10-01 13:05 ` n.pettik 2018-10-08 19:39 ` Imeev Mergen 2018-10-09 14:15 ` n.pettik 2018-10-10 16:27 ` Imeev Mergen 2018-10-11 15:09 ` n.pettik [this message] 2018-10-11 17:09 ` Imeev Mergen 2018-10-12 13:50 ` n.pettik 2018-11-01 14:37 ` 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=A38890C9-9974-4677-AFED-E6D0C3FBDD8F@tarantool.org \ --to=korablev@tarantool.org \ --cc=imeevma@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v2 1/1] sql: cleanup on failed creation operation' \ /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