space_object:replace() / put()
-
object
space_object
¶ -
space_object:
replace
(tuple)¶ -
space_object:
put
(tuple)¶ 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 variantsbox.space...:replace()
andbox.space...:put()
have the same effect; the latter is sometimes used to show that the effect is the converse ofbox.space...:get()
.Parameters: - space_object (
space_object
) – an object reference - tuple (
table/tuple
) – tuple to be inserted
Return: the inserted tuple.
Rtype: tuple
Possible errors:
ER_TUPLE_FOUND
if a different tuple with the same unique-key value already exists. (This will only happen if there is a unique secondary index.)ER_TRANSACTION_CONFLICT
if 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.
- space_object (
-