From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Kirill Yukhin <kyukhin@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH] sql: refactor primary index creation
Date: Fri, 20 Jul 2018 17:34:26 +0300 [thread overview]
Message-ID: <C8606850-C6D9-4819-BA48-7CBF6AC721B5@tarantool.org> (raw)
In-Reply-To: <20180720130806.mjf7ww3qt4t7maot@tarantool.org>
[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]
LGTM, except for 1 comment.
> @@ -862,10 +861,6 @@ sqlite3AddDefaultValue(Parse * pParse, ExprSpan * pSpan)
> * a primary key (and this is the second primary key) then create an
> * error.
> *
> - * Set the Table.iPKey field of the table under construction to be the
> - * index of the INTEGER PRIMARY KEY column.
> - * Table.iPKey is set to -1 if there is no INTEGER PRIMARY KEY.
> - *
> * If the key is not an INTEGER PRIMARY KEY, then create a unique
> * index for the key. No index is created for INTEGER PRIMARY KEYs.
> */
> @@ -923,14 +918,24 @@ sqlite3AddPrimaryKey(Parse * pParse, /* Parsing context */
> (pTab->def->fields[iCol].type == FIELD_TYPE_INTEGER) &&
> sortOrder != SORT_ORDER_DESC) {
> assert(autoInc == 0 || autoInc == 1);
> - pTab->iPKey = iCol;
> - pTab->keyConf = (u8) onError;
> if (autoInc) {
> pTab->iAutoIncPKey = iCol;
> pTab->tabFlags |= TF_Autoincrement;
> }
> - if (pList)
> - pParse->iPkSortOrder = pList->a[0].sort_order;
> + struct sqlite3 *db = pParse->db;
> + struct ExprList *list;
> + struct Token token;
> + sqlite3TokenInit(&token, pTab->def->fields[iCol].name);
> + list = sql_expr_list_append(db, NULL,
> + sqlite3ExprAlloc(db, TK_ID,
> + &token, 0));
> + if (list == NULL)
> + return;
I guess here should also be goto primary_key_exit;
[-- Attachment #2: Type: text/html, Size: 42030 bytes --]
next prev parent reply other threads:[~2018-07-20 14:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 8:33 [tarantool-patches] " Kirill Yukhin
2018-07-20 12:11 ` [tarantool-patches] " n.pettik
2018-07-20 13:08 ` Kirill Yukhin
2018-07-20 14:34 ` n.pettik [this message]
2018-07-20 14:40 ` 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=C8606850-C6D9-4819-BA48-7CBF6AC721B5@tarantool.org \
--to=korablev@tarantool.org \
--cc=kyukhin@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH] sql: refactor primary index creation' \
/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