Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: allow ON CONFLICT REPLACE only for PK index
Constraints which require VDBE bytecode will be executed before making insertion into Tarantool. For three major constraints - UNIQUE, FOREIGN-KEY, CHECK the execution order doesn't matter if error action is not REPLACE, because one constraint violation doesn't affect others. But violation of constraint with ON CONFLICT REPLACE leads to a removal of the whole tuple. When only PRIMARY KEY has REPLACE as error action, it is not a problem and such behavior is absolutely similar to Tarantool. But when we are dealing with secondary index NOT NULL constraint with ON CONFLICT REPLACE, conflict in secondary index leads to a whole tuple removal, and as a result when there is also a conflict in primary key index, insertion will lead to success instead of raising error. In this patch possibility to create constraint non PRIMARY KEY constraint with ON CONFLICT REPLACE has been banned, that kind of behavior leads to a proper error message. Closes #2963
- Loading branch information
1 parent
b47d163
commit f74f806
Showing
5 changed files
with
70 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.