From: Nikita Pettik <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Nikita Pettik <korablev@tarantool.org> Subject: [tarantool-patches] [PATCH 3/6] sql: remove start token from sql_create_index args Date: Wed, 9 Jan 2019 14:13:17 +0200 [thread overview] Message-ID: <ab0dae59f33bc9e1364bd1e7f0b4a058d0945668.1547035183.git.korablev@tarantool.org> (raw) In-Reply-To: <cover.1547035183.git.korablev@tarantool.org> In-Reply-To: <cover.1547035183.git.korablev@tarantool.org> It is not used anymore and can be removed. Part of #3097 --- src/box/sql/build.c | 10 ++++------ src/box/sql/parse.y | 9 +++++---- src/box/sql/sqliteInt.h | 5 ++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/box/sql/build.c b/src/box/sql/build.c index 963b16626..9d31cb736 100644 --- a/src/box/sql/build.c +++ b/src/box/sql/build.c @@ -727,7 +727,7 @@ sqlite3AddPrimaryKey(Parse * pParse, /* Parsing context */ &token, 0)); if (list == NULL) goto primary_key_exit; - sql_create_index(pParse, 0, 0, list, 0, SORT_ORDER_ASC, + sql_create_index(pParse, 0, 0, list, SORT_ORDER_ASC, false, SQL_INDEX_TYPE_CONSTRAINT_PK); if (db->mallocFailed) goto primary_key_exit; @@ -736,7 +736,7 @@ sqlite3AddPrimaryKey(Parse * pParse, /* Parsing context */ "INTEGER PRIMARY KEY or INT PRIMARY KEY"); goto primary_key_exit; } else { - sql_create_index(pParse, 0, 0, pList, 0, sortOrder, false, + sql_create_index(pParse, 0, 0, pList, sortOrder, false, SQL_INDEX_TYPE_CONSTRAINT_PK); pList = 0; if (pParse->nErr > 0) @@ -2227,8 +2227,8 @@ constraint_is_named(const char *name) void sql_create_index(struct Parse *parse, struct Token *token, struct SrcList *tbl_name, struct ExprList *col_list, - MAYBE_UNUSED struct Token *start, enum sort_order sort_order, - bool if_not_exist, enum sql_index_type idx_type) { + enum sort_order sort_order, bool if_not_exist, + enum sql_index_type idx_type) { /* The index to be created. */ struct index *index = NULL; /* Name of the index. */ @@ -2269,7 +2269,6 @@ sql_create_index(struct Parse *parse, struct Token *token, if (parse->pNewTable == NULL) goto exit_create_index; assert(token == NULL); - assert(start == NULL); space = parse->pNewTable->space; def = parse->pNewTable->def; } @@ -2524,7 +2523,6 @@ sql_create_index(struct Parse *parse, struct Token *token, P4_SPACEPTR); sqlite3VdbeChangeP5(vdbe, OPFLAG_SEEKEQ); - assert(start != NULL); int index_id = getNewIid(parse, def->id, cursor); sqlite3VdbeAddOp1(vdbe, OP_Close, cursor); vdbe_emit_create_index(parse, def, index->def, diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y index 874a67a9b..0b1cef597 100644 --- a/src/box/sql/parse.y +++ b/src/box/sql/parse.y @@ -262,7 +262,7 @@ ccons ::= NULL onconf(R). { ccons ::= NOT NULL onconf(R). {sql_column_add_nullable_action(pParse, R);} ccons ::= PRIMARY KEY sortorder(Z) autoinc(I). {sqlite3AddPrimaryKey(pParse,0,I,Z);} -ccons ::= UNIQUE. {sql_create_index(pParse,0,0,0,0, +ccons ::= UNIQUE. {sql_create_index(pParse,0,0,0, SORT_ORDER_ASC, false, SQL_INDEX_TYPE_CONSTRAINT_UNIQUE);} ccons ::= CHECK LP expr(X) RP. {sql_add_check_constraint(pParse,&X);} @@ -313,7 +313,7 @@ tconsname ::= . {pParse->constraint->name.n = 0;} tcons ::= PRIMARY KEY LP sortlist(X) autoinc(I) RP. {sqlite3AddPrimaryKey(pParse,X,I,0);} tcons ::= UNIQUE LP sortlist(X) RP. - {sql_create_index(pParse,0,0,X,0, + {sql_create_index(pParse,0,0,X, SORT_ORDER_ASC,false, SQL_INDEX_TYPE_CONSTRAINT_UNIQUE);} tcons ::= CHECK LP expr(E) RP onconf. @@ -1207,9 +1207,10 @@ paren_exprlist(A) ::= LP exprlist(X) RP. {A = X;} ///////////////////////////// The CREATE INDEX command /////////////////////// // -cmd ::= createkw(S) uniqueflag(U) INDEX ifnotexists(NE) nm(X) +cmd ::= createkw uniqueflag(U) INDEX ifnotexists(NE) nm(X) ON nm(Y) LP sortlist(Z) RP. { - sql_create_index(pParse, &X, sqlite3SrcListAppend(pParse->db,0,&Y), Z, &S, + + sql_create_index(pParse, &X, sqlite3SrcListAppend(pParse->db,0,&Y), Z, SORT_ORDER_ASC, NE, U); } diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h index 51a5d01b5..67243ca01 100644 --- a/src/box/sql/sqliteInt.h +++ b/src/box/sql/sqliteInt.h @@ -3510,7 +3510,6 @@ void sqlite3IdListDelete(sqlite3 *, IdList *); * @param token Index name. May be NULL. * @param tbl_name Table to index. Use pParse->pNewTable ifNULL. * @param col_list A list of columns to be indexed. - * @param start The CREATE token that begins this statement. * @param sort_order Sort order of primary key when pList==NULL. * @param if_not_exist Omit error if index already exists. * @param idx_type The index type. @@ -3518,8 +3517,8 @@ void sqlite3IdListDelete(sqlite3 *, IdList *); void sql_create_index(struct Parse *parse, struct Token *token, struct SrcList *tbl_name, struct ExprList *col_list, - struct Token *start, enum sort_order sort_order, - bool if_not_exist, enum sql_index_type idx_type); + enum sort_order sort_order, bool if_not_exist, + enum sql_index_type idx_type); /** * This routine will drop an existing named index. This routine -- 2.15.1
next prev parent reply other threads:[~2019-01-09 12:13 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-09 12:13 [tarantool-patches] [PATCH 0/6] Introduce ALTER TABLE ADD CONSTRAINT UNIQUE/PK Nikita Pettik 2019-01-09 12:13 ` [tarantool-patches] [PATCH 1/6] sql: move constraint name to struct contraint_parse Nikita Pettik 2019-01-14 14:04 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 20:06 ` n.pettik 2019-01-16 20:54 ` Vladislav Shpilevoy 2019-01-17 10:56 ` Konstantin Osipov 2019-01-17 17:14 ` n.pettik 2019-01-09 12:13 ` [tarantool-patches] [PATCH 2/6] sql: rework ALTER TABLE grammar Nikita Pettik 2019-01-14 14:05 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 20:06 ` n.pettik 2019-01-16 20:54 ` Vladislav Shpilevoy 2019-01-17 11:51 ` Konstantin Osipov 2019-01-17 17:14 ` n.pettik 2019-01-18 1:42 ` Konstantin Osipov 2019-01-09 12:13 ` Nikita Pettik [this message] 2019-01-09 12:13 ` [tarantool-patches] [PATCH 4/6] sql: refactor getNewIid() function Nikita Pettik 2019-01-14 14:05 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-09 12:13 ` [tarantool-patches] [PATCH 5/6] sql: fix error message for improperly created index Nikita Pettik 2019-01-14 14:06 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 20:06 ` n.pettik 2019-01-09 12:13 ` [tarantool-patches] [PATCH 6/6] sql: introduce ALTER TABLE ADD CONSTRAINT UNIQUE/PRIMARY KEY Nikita Pettik 2019-01-14 14:06 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 20:06 ` n.pettik 2019-01-16 20:54 ` Vladislav Shpilevoy
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=ab0dae59f33bc9e1364bd1e7f0b4a058d0945668.1547035183.git.korablev@tarantool.org \ --to=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH 3/6] sql: remove start token from sql_create_index args' \ /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