tarantool / tarantool/tarantool

sql: database should be locked for modifications during some query execution

Open
#2,554 0 comments 0 reactions 1 assignee View on GitHub

@ImeevMA is already working on this.

Since Jun 16, 2022.

bug sql
Dominant language
Lua
Stars
3.7k
Forks
419
Avg merge
1d 23h
Merged PRs (30d)
88

Description

This case was found in table-14.2 test.
You can catch main idea from this code:

local json = require("json")
box.cfg{}
box.sql.execute("create table t1(a primary key);")
box.sql.execute("create table t2(a primary key);")
box.sql.execute("insert into t2 values(1);")
box.sql.execute("insert into t2 values(2);")

local function drop_t1()
  local r, msg = pcall( function () box.sql.execute("DROP TABLE t1;") end)
  return msg
end
box.internal.sql_create_function("drop_t1", drop_t1)

local result = box.sql.execute("SELECT *, drop_t1() from t2;")
print(json.encode(result)) -- [[1,null],[2,"no such table: t1"]]

the result is [[1,null],[2,"no such table: t1"]] instead of
[[1,"database table is locked"],[2,"database table is locked"]]

It is even possible to drop t2 while selecting data from it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.