[Tarantool-patches] [PATCH] sql: fix segfault in pragma table_info

Nikita Pettik korablev at tarantool.org
Thu Jan 30 15:04:12 MSK 2020


On 27 Jan 17:04, Chris Sosnin wrote:
> We should first check that primary key is not NULL.
> 
> Closes #4745
> ---

Patch is OK as obvious. I've come up with few nits concernings test.

> --- a/test/sql/engine.cfg
> +++ b/test/sql/engine.cfg
> @@ -2,6 +2,7 @@
>      "vinyl-opts.test.lua" : {
>          "vinyl": {"engine": "vinyl"}
>      },
> +    "gh-4745-table-info-assertion.test.lua": { },
>      "bind.test.lua": {
>          "remote": {"remote": "true"},
>          "local": {"remote": "false"}
> diff --git a/test/sql/gh-4745-table-info-assertion.result b/test/sql/gh-4745-table-info-assertion.result
> new file mode 100644
> index 000000000..51a75b816
> --- /dev/null
> +++ b/test/sql/gh-4745-table-info-assertion.result
> @@ -0,0 +1,8 @@
> +-- test-run result file version 2
> +--
> +-- The following pragma shouldn't cause
> +-- assertion fault
> +--
> +table_info = box.execute('pragma table_info("_vinyl_deferred_delete")')
> + | ---
> + | ...
> diff --git a/test/sql/gh-4745-table-info-assertion.test.lua b/test/sql/gh-4745-table-info-assertion.test.lua
> new file mode 100644
> index 000000000..19d2f6955
> --- /dev/null
> +++ b/test/sql/gh-4745-table-info-assertion.test.lua
> @@ -0,0 +1,5 @@
> +--
> +-- The following pragma shouldn't cause
> +-- assertion fault
> +--

I'd add a bit of details:

-- Make sure that 'pragma table_info()' correctly handles tables
-- without primary key.

> +table_info = box.execute('pragma table_info("_vinyl_deferred_delete")')

To ignore statement result as a rule we use underscore:

_ = box.execute(...)

Finally, personally I wouldn't focus on particular '_vinyl_deferred_delete'
system space, but rather create casual space without pk and/or format and
use it in the test. Then we could run it using both engines.

> -- 
> 2.21.1 (Apple Git-122.3)
> 


More information about the Tarantool-patches mailing list