sql: fix grammar for foreign key actions
SQLite grammar implementing foreign keys parsing is quite compact, but on the other hand it allows to define ON DELETE and ON UPDATE actions multiple times. For instance: ... REFERENCES t ON DELETE UPDATE ON DELETE RESTRICT; It makes no sense and contradicts original ANSI syntax. So, lets rework it a bit. Firstly, MATCH clause must come first, so we place it in independent rule. Then we remove ON INSERT clause, since there is no such opportunity at all. Finally, we have only 4 options to expose refargs (i.e. grammar rule to parse FK actions): ON UPDATE, ON DELETE, ON UPDATE ON DELETE, ON DELETE ON UPDATE. That's it. Closes #3475
Showing
- src/box/sql/build.c 2 additions, 2 deletionssrc/box/sql/build.c
- src/box/sql/parse.y 23 additions, 17 deletionssrc/box/sql/parse.y
- src/box/sql/sqlInt.h 4 additions, 3 deletionssrc/box/sql/sqlInt.h
- test/sql-tap/alter2.test.lua 2 additions, 2 deletionstest/sql-tap/alter2.test.lua
- test/sql/foreign-keys.result 25 additions, 1 deletiontest/sql/foreign-keys.result
- test/sql/foreign-keys.test.lua 10 additions, 1 deletiontest/sql/foreign-keys.test.lua
Loading
Please register or sign in to comment