box: drop space_id for FK referring to same space
It is inconvenient to create self-referencing FK constraints, as the space ID will only be generated during space creation. This is especially useful for SQL, since the format for the space is created at compile time, and the space ID is only obtained at run time. Closes #7200 @TarantoolBot document Title: Describe foreign keys referring to the same space Since: 2.11 Root document: https://www.tarantool.io/en/doc/latest/book/box/data_model/#foreign-keys It is possible to create a foreign key that refers to the same space (a child space equals to the parent space). To do that, omit `space` in the `foreign_key` parameter, or set it to the id or to the name of the current space.
Showing
- changelogs/unreleased/gh-7200-use-0-as-space-id-for-self-fkey.md 4 additions, 0 deletions...ogs/unreleased/gh-7200-use-0-as-space-id-for-self-fkey.md
- src/box/lua/schema.lua 19 additions, 20 deletionssrc/box/lua/schema.lua
- src/box/lua/space.cc 6 additions, 1 deletionsrc/box/lua/space.cc
- src/box/tuple_constraint_def.c 7 additions, 5 deletionssrc/box/tuple_constraint_def.c
- src/box/tuple_constraint_fkey.c 5 additions, 2 deletionssrc/box/tuple_constraint_fkey.c
- test/engine-luatest/gh_6436_field_foreign_key_test.lua 0 additions, 10 deletionstest/engine-luatest/gh_6436_field_foreign_key_test.lua
- test/engine-luatest/gh_7200_fkey_without_space_id_test.lua 108 additions, 0 deletionstest/engine-luatest/gh_7200_fkey_without_space_id_test.lua
Loading
Please register or sign in to comment