Skip to content

Commit

Permalink
sql: remove unnecessary AUTOINCREMENT ID generation
Browse files Browse the repository at this point in the history
Currently, if we perform something like
CREATE TABLE t1 (
        s1 INTEGER PRIMARY KEY AUTOINCREMENT,
        s2 INTEGER,
        CHECK (s1 <> 19)
);
INSERT INTO t1 VALUES (18, NULL);
INSERT INTO t1 (s2) VALUES (NULL);

we generate a new identifier in VDBE, but in any other case we
generate it in BOX. That was needed since the CHECK did not work
properly. This is not necessary now, because CHECK was moved to
BOX due to issue #3691. After this patch all new identifiers will
be generated in BOX.

Part of #4188
  • Loading branch information
ImeevMA committed Jul 11, 2019
1 parent 31a2644 commit 89267d9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/box/sql/insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,7 @@ sqlInsert(Parse * pParse, /* Parser context */
if (j < 0 || nColumn == 0
|| (pColumn && j >= pColumn->nId)) {
if (i == (int) autoinc_fieldno) {
sqlVdbeAddOp2(v,
OP_NextAutoincValue,
space->def->id,
iRegStore);
sqlVdbeAddOp2(v, OP_Null, 0, iRegStore);
continue;
}
struct Expr *dflt = NULL;
Expand Down

0 comments on commit 89267d9

Please sign in to comment.