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 5A3892CD68 for ; Wed, 4 Apr 2018 08:38:21 -0400 (EDT) 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 IWffHmjpI7rr for ; Wed, 4 Apr 2018 08:38:21 -0400 (EDT) Received: from smtp49.i.mail.ru (smtp49.i.mail.ru [94.100.177.109]) (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 194BB2CD61 for ; Wed, 4 Apr 2018 08:38:20 -0400 (EDT) From: Bulat Niatshin Subject: [tarantool-patches] [PATCH] sql: remove unnecessary MakeRecord opcodes Date: Wed, 4 Apr 2018 15:38:13 +0300 Message-Id: <20180404123813.93961-1-niatshin@tarantool.org> 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: korablev@tarantool.org, Bulat Niatshin OP_MakeRecord creates a record from a given range of registers and stores that record in a specified register. But now even secondary indexes with non-default ON CONFLICT clause doesn't need it, it is necessary only for primary key indexes. However that unnecesary opcodes appear in INSERT listings. This patch contains a fix for that. Closes #3317 --- src/box/sql/insert.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c index 4a57b23f5..701fae412 100644 --- a/src/box/sql/insert.c +++ b/src/box/sql/insert.c @@ -1309,18 +1309,10 @@ sqlite3GenerateConstraintChecks(Parse * pParse, /* The parser context */ sqlite3VdbeResolveLabel(v, skip_if_null); } } - if (IsPrimaryKeyIndex(pIdx) || uniqueByteCodeNeeded) { - sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData + 1, - pTab->nCol, aRegIdx[ix]); - VdbeComment((v, "for %s", pIdx->zName)); - } - } else { - /* kyukhin: for Tarantool, this should be evaluated to NOP. */ - if (IsPrimaryKeyIndex(pIdx) || uniqueByteCodeNeeded) { - sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, - nIdxCol, aRegIdx[ix]); - VdbeComment((v, "for %s", pIdx->zName)); - } + + sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData + 1, + pTab->nCol, aRegIdx[ix]); + VdbeComment((v, "for %s", pIdx->zName)); } /* In an UPDATE operation, if this index is the PRIMARY KEY -- 2.14.1