From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 9B1DA43D67A for ; Thu, 17 Oct 2019 18:03:03 +0300 (MSK) Date: Thu, 17 Oct 2019 18:03:02 +0300 From: Nikita Pettik Message-ID: <20191017150302.GH23167@tarantool.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH v1 1/1] sql: fix fk violation for autoincremented field List-Id: Tarantool development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org, tarantool-patches@dev.tarantool.org 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 >