[Tarantool-patches] [PATCH v1 1/1] sql: fix fk violation for autoincremented field

Nikita Pettik korablev at tarantool.org
Thu Oct 17 18:03:02 MSK 2019


On 17 Oct 17:32, Kirill Shcherbatov wrote:
> Fk constraints used to ignore incremented fields that are
> represented with NULL placeholders in a tuple during FK tests in
> the SQL frontend. A factual value is inserted in a tuple a bit
> later, during DML 'insert' operation on the server side.
> 
> To work around this issue a new OP_NextSequenceValue opcode is
> introduced. This new operation retrieves a next sequence value
> (that will be factually inserted in a tuple later) to test it
> for fk constraint compatibility.
> Closes #4565
> ---
> Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-4546-fk-autoincrement
> Issue: https://github.com/tarantool/tarantool/issues/4546
> 

Please split patch into two: first one which affects box and sequence_next()
refactoring and second one which fixes SQL bahaviour. Thanks.
 
>  src/box/sequence.c                         | 54 ++++++++-----
>  src/box/sequence.h                         | 11 +++
>  src/box/sql/fk_constraint.c                | 30 +++++++-
>  src/box/sql/vdbe.c                         | 21 +++++
>  test/sql/gh-4565-fk-autoincrement.result   | 90 ++++++++++++++++++++++
>  test/sql/gh-4565-fk-autoincrement.test.lua | 26 +++++++
>  6 files changed, 211 insertions(+), 21 deletions(-)
>  create mode 100644 test/sql/gh-4565-fk-autoincrement.result
>  create mode 100644 test/sql/gh-4565-fk-autoincrement.test.lua
> 


More information about the Tarantool-patches mailing list