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 5C03422242 for ; Tue, 10 Jul 2018 14:22: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 M5XBUYgUzLwd for ; Tue, 10 Jul 2018 14:22:21 -0400 (EDT) Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (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 19BE320097 for ; Tue, 10 Jul 2018 14:22:20 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH v2 3/4] sql: refactor vdbe_emit_open_cursor calls From: "n.pettik" In-Reply-To: <66f3383d8d49c9ac059a72ff47bf235c9cf11da7.1531242355.git.kshcherbatov@tarantool.org> Date: Tue, 10 Jul 2018 21:22:17 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <7EFC158D-8B80-4B12-8293-514077BD6923@tarantool.org> References: <66f3383d8d49c9ac059a72ff47bf235c9cf11da7.1531242355.git.kshcherbatov@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: Kirill Shcherbatov > diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c > index 58e159c..62b85d5 100644 > --- a/src/box/sql/insert.c > +++ b/src/box/sql/insert.c > @@ -179,41 +179,51 @@ sqlite3TableAffinity(Vdbe * v, Table * pTab, int = iReg) > -static int > -readsTable(Parse * p, Table * pTab) > +static bool > +vdbe_has_table_read(struct Parse *parser, const struct Table *table) > { > + if (op->opcode =3D=3D OP_OpenRead || op->opcode =3D=3D = OP_OpenWrite) { > + assert(i > 1); > + struct VdbeOp *space_var_op =3D > + sqlite3VdbeGetOp(v, i - 1); > + assert(space_var_op !=3D NULL); > + assert(space_var_op->opcode =3D=3D OP_LoadPtr); > + struct space *space =3D space_var_op->p4.space; > + > + if (space->def->id =3D=3D table->def->id) > + return true; > + > + int idx_id =3D op->p2; > + for (struct Index *pIndex =3D table->pIndex; > + pIndex !=3D NULL; pIndex =3D = pIndex->pNext) { > + if (idx_id =3D=3D > + = SQLITE_PAGENO_TO_INDEXID(pIndex->tnum)) > + return true; Why do you need these index iterations? If spaces don=E2=80=99t match, = what is the point to check index ids? Btw, I deleted this code and all tests seem to = pass. The rest is OK in this patch.