Skip to content

splice update operation now supports varbinary #4237

Open
@TarantoolBot

Description

@TarantoolBot

Related dev. issue(s): tarantool/tarantool#9997
Related doc. issue(s): #3551 (should be fixed before #4237)

Product: Tarantool
Since: 3.2.0
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/update/
SME: @ alyapunov

Details

Just in case splice is an update operation that can modify string
field, deleting a part of it and inserting something instead.

tarantool> box.tuple.new{'1234567'}:update{{':', 1, 2, 3, '!'}}
---
- ['1!567']
...

In the this example splice operation ':' takes field 1 of tuple,
takes position 2 in string, removes 3 symbols and inserts '!' to
that position.

Both deletion and insertion can naturally degrade to no-op.

Before this patch a splice operation required both field and
inserting argument to be strings.

This patch allows the field and the argument to be varbinary.

tarantool> varb = require('varbinary')
tarantool> t = box.tuple.new{varb.new('1234567')}
tarantool> t:update{{':', 1, 2, 3, varb.new('!')}}
---
- [!!binary MSE1Njc=]
...

That also allows to insert strings into varbinary fields and
insert varbinary data into string. The actual field type after
update such operation remains the same, so updated string will
be string, while updated varbinary will be varbinary.

Closes #9997
Requested by @ alyapunov in tarantool/tarantool@aaa0ad0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.2reference[location] Tarantool manual, Reference part

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions