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 9AC9125246 for ; Thu, 17 May 2018 12:47:10 -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 yACNzG-SVucm for ; Thu, 17 May 2018 12:47:10 -0400 (EDT) Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [94.100.177.101]) (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 58CE825244 for ; Thu, 17 May 2018 12:47:10 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 1/2] sql: allow key_def to be NULL for ephemeral create References: <54fef8ed5144ab8ee384687caa3448a89ac62746.1526483543.git.kyukhin@tarantool.org> <20180517154939.ya64lgo4ifipmofk@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Thu, 17 May 2018 19:47:08 +0300 MIME-Version: 1.0 In-Reply-To: <20180517154939.ya64lgo4ifipmofk@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit 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: Kirill Yukhin Cc: tarantool-patches@freelists.org Thanks for review fixes! See 4 comments below. On 17/05/2018 18:49, Kirill Yukhin wrote: > Hi Vlad, > > On 16 мая 18:24, Kirill Yukhin wrote: >> There're many cases in SQL FE, where exact key def passed to >> doesn't ephemeral table matter. It is used to store data only. 1. Can't read. Maybe 'where exact key def passed to ephemeral table doesn't matter' ? >> Only field count makes sense in such a case. Hoewever it is 2. However. >> passed separately (in P2). So, allow P4 field to be NULL for >> OP_OpenTEphemeral. Update delte from routine from sql/delete.c 3. delete. >> accordingly. >> >> Part of #3235 > Pasting updated patch from 1st round of review of 1/2 patch. > > diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c > index 22130ef..1ad7469 100644 > --- a/src/box/sql/insert.c > +++ b/src/box/sql/insert.c > @@ -566,13 +566,8 @@ sqlite3Insert(Parse * pParse, /* Parser context */ > regRec = sqlite3GetTempReg(pParse); > regCopy = sqlite3GetTempRange(pParse, nColumn); > regTempId = sqlite3GetTempReg(pParse); > - struct key_def *def = key_def_new(nColumn + 1); > - if (def == NULL) { > - sqlite3OomFault(db); > - goto insert_cleanup; > - } > sqlite3VdbeAddOp4(v, OP_OpenTEphemeral, srcTab, nColumn+1, > - 0, (char*)def, P4_KEYDEF); > + 0, (char*)NULL, P4_KEYDEF); 4. In the OP_OpenTEphemeral code you check for P4_KEYDEF absence, so you can use AddOp2 here. And in other places.