From: "n.pettik" <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: [tarantool-patches] Re: [PATCH 09/10] sql: disable ON CONFLICT actions for indexes Date: Sun, 26 Aug 2018 22:44:42 +0300 [thread overview] Message-ID: <9C5A6A50-CB06-489D-A708-28DC346EA013@tarantool.org> (raw) In-Reply-To: <dbe085fd-79d8-68ef-dd84-b757f1b2224d@tarantool.org> >> diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c >> index 33d243414..9da971415 100644 >> --- a/src/box/sql/insert.c >> +++ b/src/box/sql/insert.c >> @@ -354,11 +351,14 @@ sqlite3Insert(Parse * pParse, /* Parser context */ >> } >> #endif /* SQLITE_OMIT_XFER_OPT */ >> - /* Allocate registers for holding the tupleid of the new row, >> - * the content of the new row, and the assembled row record. >> + /* >> + * Allocate registers for holding the tupleid of the new >> + * row (if it isn't required first register will contain >> + * NULL), the content of the new row, and the assembled >> + * row record. >> */ >> regTupleid = regIns = pParse->nMem + 1; >> - pParse->nMem += def->field_count + 1; >> + pParse->nMem += def->field_count + 2; > > Why +2? My presumption is because nMem was not > incremented one line above here 'regTupleid = regIns = pParse->nMem + 1;', > am I right? Why did it work before? As comments says: field_count for raw data to be encoded into tuple, one memory cell for encoded tuple, and the last one for rowid (or tupleid): it is used for ephemeral spaces to distinguish entries. If it is not required, then mem will contain NULL. Tuple id (regTupleId) comes first, then raw tuple and in the end - encoded msgpack. > > Then could you do it slightly more clear, like this? > > regTupleid = regIns = ++pParse->nMem; > pParse->nMem += def->field_count + 1; As you wish. Simply applied your code: +++ b/src/box/sql/insert.c @@ -357,8 +357,8 @@ sqlite3Insert(Parse * pParse, /* Parser context */ * NULL), the content of the new row, and the assembled * row record. */ - regTupleid = regIns = pParse->nMem + 1; - pParse->nMem += def->field_count + 2; + regTupleid = regIns = ++pParse->nMem; + pParse->nMem += def->field_count + 1
next prev parent reply other threads:[~2018-08-26 19:44 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-12 14:12 [tarantool-patches] [PATCH 00/10] sql: cleanup in struct Index and struct Table Nikita Pettik 2018-08-12 14:12 ` [tarantool-patches] [PATCH 01/10] sql: remove suport of ALTER TABLE ADD COLUMN Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-12 14:12 ` [tarantool-patches] [PATCH 02/10] sql: remove string of fields collation from Table Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-12 14:12 ` [tarantool-patches] [PATCH 03/10] sql: remove index hash from struct Table Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-12 14:13 ` [tarantool-patches] [PATCH 04/10] sql: remove flags " Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-12 14:13 ` [tarantool-patches] [PATCH 05/10] sql: remove affinity string of columns from Index Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-21 16:31 ` n.pettik 2018-08-24 21:04 ` Vladislav Shpilevoy 2018-08-26 19:45 ` n.pettik 2018-08-12 14:13 ` [tarantool-patches] [PATCH 06/10] sql: completely remove support of partial indexes Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-21 16:31 ` n.pettik 2018-08-24 21:04 ` Vladislav Shpilevoy 2018-08-26 19:44 ` n.pettik 2018-08-12 14:13 ` [tarantool-patches] [PATCH 07/10] sql: remove index type from struct Index Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-21 16:31 ` n.pettik 2018-08-12 14:13 ` [tarantool-patches] [PATCH 08/10] sql: use secondary indexes to process OP_Delete Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-12 14:13 ` [tarantool-patches] [PATCH 09/10] sql: disable ON CONFLICT actions for indexes Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-21 16:31 ` n.pettik 2018-08-24 21:04 ` Vladislav Shpilevoy 2018-08-26 19:44 ` n.pettik [this message] 2018-08-27 17:24 ` Vladislav Shpilevoy 2018-08-12 14:13 ` [tarantool-patches] [PATCH 10/10] sql: move autoincrement field number to server Nikita Pettik 2018-08-13 20:24 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-21 16:31 ` n.pettik 2018-08-24 21:03 ` Vladislav Shpilevoy 2018-08-26 19:44 ` n.pettik 2018-08-27 17:24 ` Vladislav Shpilevoy 2018-08-27 17:24 ` [tarantool-patches] Re: [PATCH 00/10] sql: cleanup in struct Index and struct Table Vladislav Shpilevoy 2018-08-29 14:11 ` 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=9C5A6A50-CB06-489D-A708-28DC346EA013@tarantool.org \ --to=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='[tarantool-patches] Re: [PATCH 09/10] sql: disable ON CONFLICT actions for indexes' \ /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