From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: "n.pettik" <korablev@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH 6/6] sql: introduce ALTER TABLE ADD CONSTRAINT UNIQUE/PRIMARY KEY Date: Wed, 16 Jan 2019 23:54:07 +0300 [thread overview] Message-ID: <713cc1b5-1a1e-31f0-4ad7-e78571ee4d26@tarantool.org> (raw) In-Reply-To: <A57AFCB3-F2AF-4FD5-BFD7-2DE0DBE1719A@tarantool.org> >>> + sqlite3VdbeAddOp2(v, OP_Integer, space_id, tmp_reg); >>> + int found_addr = sqlite3VdbeAddOp4Int(v, OP_NotFound, cursor, 0, >>> + tmp_reg, 1); >>> + sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_ERROR, ON_CONFLICT_ACTION_FAIL, 0, >>> + "multiple primary keys are not allowed", P4_STATIC); >>> + sqlite3VdbeJumpHere(v, found_addr); >>> +} >>> + >>> /** >>> * Add new index to table's indexes list. >>> * We follow convention that PK comes first in list. >>> diff --git a/test/sql-tap/alter.test.lua b/test/sql-tap/alter.test.lua >>> index 1aad555c0..925753749 100755 >>> --- a/test/sql-tap/alter.test.lua >>> +++ b/test/sql-tap/alter.test.lua >>> @@ -517,6 +517,62 @@ test:do_catchsql_test( >>> -- </alter-7.11> >>> }) >>> +test:do_test( >>> + "alter-8.1.0", >>> + function() >>> + format = {} >>> + format[1] = { name = 'id', type = 'scalar'} >>> + format[2] = { name = 'f2', type = 'scalar'} >>> + s = box.schema.create_space('T', {format = format}) >>> + end, >>> + {}) >>> + >>> +test:do_catchsql_test( >>> + "alter-8.1.1", >>> + [[ >>> + ALTER TABLE t ADD CONSTRAINT pk PRIMARY KEY("id"); >>> + ]], { >>> + 0 >>> + }) >>> + >>> +test:do_test( >>> + "alter-8.1.2", >>> + function() >>> + i = box.space.T.index[0] >>> + return i.id >> >> 3. Why not return box.space.T.index[0].id? > > … I know, nit, but I do not like excess useless lines. Cuts the eye, sorry. > > diff --git a/test/sql-tap/alter.test.lua b/test/sql-tap/alter.test.lua > index 925753749..318b0f68d 100755 > --- a/test/sql-tap/alter.test.lua > +++ b/test/sql-tap/alter.test.lua > @@ -538,8 +538,7 @@ test:do_catchsql_test( > test:do_test( > "alter-8.1.2", > function() > - i = box.space.T.index[0] > - return i.id > + return box.space.T.index[0].id > end, 0) > >
prev parent reply other threads:[~2019-01-16 20:54 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-09 12:13 [tarantool-patches] [PATCH 0/6] Introduce ALTER TABLE ADD CONSTRAINT UNIQUE/PK Nikita Pettik 2019-01-09 12:13 ` [tarantool-patches] [PATCH 1/6] sql: move constraint name to struct contraint_parse Nikita Pettik 2019-01-14 14:04 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 20:06 ` n.pettik 2019-01-16 20:54 ` Vladislav Shpilevoy 2019-01-17 10:56 ` Konstantin Osipov 2019-01-17 17:14 ` n.pettik 2019-01-09 12:13 ` [tarantool-patches] [PATCH 2/6] sql: rework ALTER TABLE grammar Nikita Pettik 2019-01-14 14:05 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 20:06 ` n.pettik 2019-01-16 20:54 ` Vladislav Shpilevoy 2019-01-17 11:51 ` Konstantin Osipov 2019-01-17 17:14 ` n.pettik 2019-01-18 1:42 ` Konstantin Osipov 2019-01-09 12:13 ` [tarantool-patches] [PATCH 3/6] sql: remove start token from sql_create_index args Nikita Pettik 2019-01-09 12:13 ` [tarantool-patches] [PATCH 4/6] sql: refactor getNewIid() function Nikita Pettik 2019-01-14 14:05 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-09 12:13 ` [tarantool-patches] [PATCH 5/6] sql: fix error message for improperly created index Nikita Pettik 2019-01-14 14:06 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 20:06 ` n.pettik 2019-01-09 12:13 ` [tarantool-patches] [PATCH 6/6] sql: introduce ALTER TABLE ADD CONSTRAINT UNIQUE/PRIMARY KEY Nikita Pettik 2019-01-14 14:06 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 20:06 ` n.pettik 2019-01-16 20:54 ` Vladislav Shpilevoy [this message]
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=713cc1b5-1a1e-31f0-4ad7-e78571ee4d26@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH 6/6] sql: introduce ALTER TABLE ADD CONSTRAINT UNIQUE/PRIMARY KEY' \ /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