Updated at July 17, 2026 02:08 PM
space_object:replace() / put()
space_object
Insert a tuple into a space. If a tuple with the same primary key
already exists, box.space...:replace() replaces the existing tuple
with a new one. The syntax variants box.space...:replace() and
box.space...:put() have the same effect; the latter is sometimes used
to show that the effect is the converse of box.space...:get().
Parameters:
-
space_object(space_object) — an object reference -
tuple(table/tuple) — tuple to be inserted
Returns
the inserted tuple.
Return type
tuple
Possible errors:
ER_TUPLE_FOUNDif a different tuple with the same unique-key value already exists. (This will only happen if there is a unique secondary index.)ER_TRANSACTION_CONFLICTif a transaction conflict is detected in the MVCC transaction mode.
Complexity factors: Index size, Index type, Number of indexes accessed, WAL settings.
Example:
box.space.tester:replace{5000, 'tuple number five thousand'}
For more usage scenarios and typical errors see Example: using data operations further in this section.