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 4961B2F2B8 for ; Tue, 13 Nov 2018 11:11:28 -0500 (EST) 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 LsQ324tuma0J for ; Tue, 13 Nov 2018 11:11:28 -0500 (EST) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 7CFC32C0A8 for ; Tue, 13 Nov 2018 11:11:27 -0500 (EST) From: Nikita Pettik Subject: [tarantool-patches] [PATCH v2 1/4] sql: don't increment row count on FK creation within CREATE TABLE Date: Tue, 13 Nov 2018 19:11:20 +0300 Message-Id: <6c6636af9339de4965f13cf56496ea2e05525d38.1542124689.git.korablev@tarantool.org> In-Reply-To: References: In-Reply-To: References: 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, Nikita Pettik We have agreement that each successful DDL operation returns 1 (one) as a row count (via IProto protocol or changes() SQL function), despite the number of other created objects (e.g. indexes, sequences, FK constraints etc). Needed for #2181 --- src/box/sql/build.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/box/sql/build.c b/src/box/sql/build.c index 5b3348bd2..e28856e26 100644 --- a/src/box/sql/build.c +++ b/src/box/sql/build.c @@ -1415,7 +1415,8 @@ vdbe_emit_fkey_create(struct Parse *parse_context, const struct fkey_def *fk) constr_tuple_reg + 9); sqlite3VdbeAddOp3(vdbe, OP_SInsert, BOX_FK_CONSTRAINT_ID, 0, constr_tuple_reg + 9); - sqlite3VdbeChangeP5(vdbe, OPFLAG_NCHANGE); + if (parse_context->pNewTable == NULL) + sqlite3VdbeChangeP5(vdbe, OPFLAG_NCHANGE); save_record(parse_context, BOX_FK_CONSTRAINT_ID, constr_tuple_reg, 2, vdbe->nOp - 1); sqlite3ReleaseTempRange(parse_context, constr_tuple_reg, 10); -- 2.15.1