Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/3] sql: restrict nullable action definitions
Date: Mon, 23 Jul 2018 19:53:55 +0300	[thread overview]
Message-ID: <f3984c22-4020-c8de-ad9f-e574e724e363@tarantool.org> (raw)
In-Reply-To: <3ede21f4-dde1-4853-b08c-f3c7f076021b@tarantool.org>

After verbal discussion, I've made small fix and merged "[draft] don't use on_conflict_default_MAX".
Don't forget that this patch is now on Kirill's iPkey patch and should be merged to upstream later.

On 23.07.2018 11:31, Kirill Shcherbatov wrote:
> Hi again!
> I've rebased my patch on Kirill's Y. branch kyukhin/gh-3482-remove-ipkey;
> I've also have succeed in using  ON_CONFLICT_ACTION_DEFAULT instead of on_conflict_action_MAX.
> This changes represented as "[draft] don't use on_conflict_default_MAX" commit on my branch.
> I've have had to introduce small rule index_onconf that looks very similar with onconf. If I not mistaken,
> you are going to get rid of Index on_conflict action; and this rudiment crap would disappear. 

=============================================

diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index ba80d1d..ec0c06b 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -950,7 +950,7 @@ sqlite3AddPrimaryKey(Parse * pParse,	/* Parsing context */
 					    sqlite3ExprAlloc(db, TK_ID,
 							     &token, 0));
 		if (list == NULL)
-			return;
+			goto primary_key_exit;
 		sql_create_index(pParse, 0, 0, list, onError, 0, 0,
 				 SORT_ORDER_ASC, false,
 				 SQL_INDEX_TYPE_CONSTRAINT_PK);
@@ -959,21 +959,23 @@ sqlite3AddPrimaryKey(Parse * pParse,	/* Parsing context */
 	} else if (autoInc) {
 		sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an "
 				"INTEGER PRIMARY KEY or INT PRIMARY KEY");
+		goto primary_key_exit;
 	} else {
 		sql_create_index(pParse, 0, 0, pList, onError, 0,
 				 0, sortOrder, false,
 				 SQL_INDEX_TYPE_CONSTRAINT_PK);
 		pList = 0;
+		if (pParse->nErr > 0)
+			goto primary_key_exit;
 	}
 
 	struct Index *pk = sqlite3PrimaryKeyIndex(pTab);
-	if (pk != NULL) {
-		struct key_def *pk_key_def = pk->def->key_def;
-		for (uint32_t i = 0; i < pk_key_def->part_count; i++) {
-			uint32_t idx = pk_key_def->parts[i].fieldno;
-			field_def_create_for_pk(pParse, &pTab->def->fields[idx],
-						pTab->def->name);
-		}
+	assert(pk != NULL);
+	struct key_def *pk_key_def = pk->def->key_def;
+	for (uint32_t i = 0; i < pk_key_def->part_count; i++) {
+		uint32_t idx = pk_key_def->parts[i].fieldno;
+		field_def_create_for_pk(pParse, &pTab->def->fields[idx],
+					pTab->def->name);
 	}
 primary_key_exit:
 	sql_expr_list_delete(pParse->db, pList);

  reply	other threads:[~2018-07-23 16:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-18 16:52 [tarantool-patches] [PATCH v1 0/3] " Kirill Shcherbatov
2018-07-18 16:52 ` [tarantool-patches] [PATCH v1 1/3] " Kirill Shcherbatov
2018-07-18 20:12   ` [tarantool-patches] " n.pettik
2018-07-19  8:12     ` Kirill Shcherbatov
2018-07-20  2:39       ` n.pettik
2018-07-20  7:29         ` Kirill Shcherbatov
2018-07-23  8:31           ` Kirill Shcherbatov
2018-07-23 16:53             ` Kirill Shcherbatov [this message]
2018-07-23 19:27               ` n.pettik
2018-07-18 16:52 ` [tarantool-patches] [PATCH v1 2/3] sql: fixed possible leak in sqlite3EndTable Kirill Shcherbatov
2018-07-18 20:12   ` [tarantool-patches] " n.pettik
2018-07-18 16:52 ` [tarantool-patches] [PATCH v1 3/3] sql: get rid of Column structure Kirill Shcherbatov
2018-07-18 20:13   ` [tarantool-patches] " n.pettik
2018-07-19  8:12     ` Kirill Shcherbatov
2018-07-19  8:39       ` Vladislav Shpilevoy
2018-07-19 10:17         ` Kirill Shcherbatov
2018-07-20  2:43       ` n.pettik
2018-07-24 15:26 ` [tarantool-patches] Re: [PATCH v1 0/3] sql: restrict nullable action definitions 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=f3984c22-4020-c8de-ad9f-e574e724e363@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/3] sql: restrict nullable action definitions' \
    /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