sql: support column addition
Enable to add column to existing space with <ALTER TABLE ADD [COLUMN]> statement. Column definition can be supplemented with the four types of constraints, <DEFAULT>, <COLLATE> clauses and <[NOT] NULL>, AUTOINCREMENT. Closes #2349, #3075 @TarantoolBot document Title: Add columns to existing tables in SQL Now, it is possible to add columns to existing empty spaces using <ALTER TABLE table_name ADD [COLUMN] column_name column_type ...> statement. The column definition is the same as in <CREATE TABLE> statement. * Space emptiness is Tarantool's restriction. Possibilty to add column to non empty space will be implemented later. For example: ``` tarantool> box.execute("CREATE TABLE test (a INTEGER PRIMARY KEY)") --- - row_count: 1 ... tarantool> box.execute([[ALTER TABLE test ADD COLUMN b TEXT > CHECK (LENGTH(b) > 1) > NOT NULL > DEFAULT ('aa') > COLLATE "unicode_ci" > ]]) --- - row_count: 1 ... ```
Showing
- extra/mkkeywordhash.c 1 addition, 1 deletionextra/mkkeywordhash.c
- src/box/errcode.h 1 addition, 0 deletionssrc/box/errcode.h
- src/box/sql/build.c 298 additions, 90 deletionssrc/box/sql/build.c
- src/box/sql/parse.y 36 additions, 10 deletionssrc/box/sql/parse.y
- src/box/sql/parse_def.h 23 additions, 3 deletionssrc/box/sql/parse_def.h
- src/box/sql/sqlInt.h 32 additions, 13 deletionssrc/box/sql/sqlInt.h
- src/box/sql/tokenize.c 13 additions, 4 deletionssrc/box/sql/tokenize.c
- test/box/error.result 1 addition, 0 deletionstest/box/error.result
- test/sql/add-column.result 529 additions, 0 deletionstest/sql/add-column.result
- test/sql/add-column.test.sql 183 additions, 0 deletionstest/sql/add-column.test.sql
- test/sql/checks.result 20 additions, 0 deletionstest/sql/checks.result
- test/sql/checks.test.lua 9 additions, 0 deletionstest/sql/checks.test.lua
- test/sql/foreign-keys.result 28 additions, 0 deletionstest/sql/foreign-keys.result
- test/sql/foreign-keys.test.lua 11 additions, 0 deletionstest/sql/foreign-keys.test.lua
Loading
Please register or sign in to comment