sql: AUTOINCREMENT for multipart PK
Prior to this patch, the auto-increment feature could only be set in an INTEGER field of PRIMARY KEY if the PRIMARY KEY consisted of a single field. It was not possible to use this feature if the PRIMARY KEY consisted of more than one field. This patch defines two ways to set AUTOINCREMENT for any INTEGER or UNSIGNED field of PRIMARY KEY. Closes #4217 @TarantoolBot document Title: The auto-increment feature for multipart PK The auto-increment feature can be set to any INTEGER or UNSIGNED field of PRIMARY KEY using one of two ways: 1) AUTOINCREMENT in column definition: CREATE TABLE t (i INT, a INT AUTOINCREMENT, PRIMARY KEY (i, a)); CREATE TABLE t (i INT AUTOINCREMENT, a INT, PRIMARY KEY (i, a)); 2) AUTOINCREMENT in PRIMARY KEY definition: CREATE TABLE t (i INT, a INT, PRIMARY KEY (i, a AUTOINCREMENT)); CREATE TABLE t (i INT, a INT, PRIMARY KEY (i AUTOINCREMENT, a));
Showing
- src/box/sql/build.c 45 additions, 23 deletionssrc/box/sql/build.c
- src/box/sql/parse.y 44 additions, 6 deletionssrc/box/sql/parse.y
- src/box/sql/parse_def.h 3 additions, 0 deletionssrc/box/sql/parse_def.h
- src/box/sql/sqlInt.h 31 additions, 0 deletionssrc/box/sql/sqlInt.h
- test/sql-tap/autoinc.test.lua 95 additions, 2 deletionstest/sql-tap/autoinc.test.lua
- test/sql-tap/sql-errors.test.lua 1 addition, 1 deletiontest/sql-tap/sql-errors.test.lua
- test/sql-tap/where4.test.lua 1 addition, 1 deletiontest/sql-tap/where4.test.lua
Loading
Please register or sign in to comment