Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org, Nikita Pettik <korablev@tarantool.org>
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	[thread overview]
Message-ID: <6c6636af9339de4965f13cf56496ea2e05525d38.1542124689.git.korablev@tarantool.org> (raw)
In-Reply-To: <cover.1542124689.git.korablev@tarantool.org>
In-Reply-To: <cover.1542124689.git.korablev@tarantool.org>

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

  reply	other threads:[~2018-11-13 16:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13 16:11 [tarantool-patches] [PATCH v2 0/4] Introduce row_count() function Nikita Pettik
2018-11-13 16:11 ` Nikita Pettik [this message]
2018-11-14 12:32   ` [tarantool-patches] Re: [PATCH v2 1/4] sql: don't increment row count on FK creation within CREATE TABLE Vladislav Shpilevoy
2018-11-14 16:20     ` n.pettik
2018-11-13 16:11 ` [tarantool-patches] [PATCH v2 2/4] sql: account REPLACE as two row changes Nikita Pettik
2018-11-14 12:32   ` [tarantool-patches] " Vladislav Shpilevoy
2018-11-14 16:20     ` n.pettik
2018-11-13 16:11 ` [tarantool-patches] [PATCH v2 3/4] sql: remove total_changes() function Nikita Pettik
2018-11-13 16:11 ` [tarantool-patches] [PATCH v2 4/4] sql: rename changes() to row_count() Nikita Pettik
2018-11-14 12:32   ` [tarantool-patches] " Vladislav Shpilevoy
2018-11-14 16:20     ` n.pettik
2018-11-14 16:43       ` Vladislav Shpilevoy
2018-11-15  5:06 ` [tarantool-patches] Re: [PATCH v2 0/4] Introduce row_count() function 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=6c6636af9339de4965f13cf56496ea2e05525d38.1542124689.git.korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH v2 1/4] sql: don'\''t increment row count on FK creation within CREATE TABLE' \
    /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