[tarantool-patches] [PATCH v4 0/4] sql: do not show IDs generated by trigger

imeevma at tarantool.org imeevma at tarantool.org
Wed Jul 17 12:54:49 MSK 2019


Currently, if an INSERT was executed by a trigger during the
execution of a statement, if there were any generated identifiers,
they can be displayed as a result of the statement. This is
incorrect, since we are not able to divide the IDs obtained into
those that belong to the table mentioned in the statement and
those that do not belong to this table.

https://github.com/tarantool/tarantool/issues/4188
https://github.com/tarantool/tarantool/tree/imeevma/gh-4188-remove-additonal-generated-ids

Changes in v2:
1) Patch was divided into 3 new patches.

Changes in v3:
1) Removed tests in refactoring patch "sql: remove unnecessary
AUTOINCREMENT ID generation". They shows nothing.
2) Changed the way to check that INSERT executed by trigger.
3) Fixed a bug with the display of generated AUTOINCREMENT
identifiers, even if INSERT failed in the case of INSERT OR
IGNORE.

Changes in v4:
1) Changed the solution for the issue. Now it works without new
opcode. However, new argument was added to OP_IdxInsert.
2) Now the patch in which VDBE does not take into account failed
inserts becomes practically useless. It has been removed. However,
a new patch was added that corrects row_count in the specified
case.

Mergen Imeev (4):
  sql: remove unnecessary AUTOINCREMENT ID generation
  sql: skip autoinc IDs generated inside SQL trigger
  sql: remove VDBE from TXN
  sql: do not increase row-count if INSERT or REPLACE failed

 src/box/sequence.c          |  19 +++++---
 src/box/sequence.h          |  13 +++--
 src/box/sql/insert.c        |  18 ++++---
 src/box/sql/sqlInt.h        |   3 +-
 src/box/sql/update.c        |   2 +-
 src/box/sql/vdbe.c          |  54 ++++++++-------------
 src/box/sql/vdbe.h          |   3 +-
 src/box/sql/vdbeInt.h       |   2 +-
 src/box/sql/vdbeaux.c       |  10 ++--
 src/box/txn.h               |  17 -------
 test/sql/iproto.result      |   2 -
 test/sql/row-count.result   |  30 ++++++++++++
 test/sql/row-count.test.lua |   8 ++++
 test/sql/triggers.result    | 114 ++++++++++++++++++++++++++++++++++++++++++++
 test/sql/triggers.test.lua  |  24 ++++++++++
 15 files changed, 239 insertions(+), 80 deletions(-)

-- 
2.7.4





More information about the Tarantool-patches mailing list