uid function not working in upsert for variables with values #4424
Labels
area/data-loss
Issues related to loss of data.
area/upsert
Issues related to upsert operations.
priority/P0
Critical issue that requires immediate attention.
What version of Dgraph are you using?
master
Have you tried reproducing the issue with the latest release?
yes
What is the hardware spec (RAM, OS)?
n/a
Steps to reproduce the issue (command/config used to run Dgraph).
Create a counter value with the following mutation:
Then increment its value with the given upsert block:
upsert { query { q(func: has(value)) { value as value inc as math(value+1) } } mutation { set { uid(inc) <value> val(inc) . } } }
Expected behaviour and actual result.
The upsert above should return the previous counter value (0) and the value of inc (1), as follows:
And a query should return the new value is 1.
Encountered behavior
The upsert returns the same value in this case, but no operation is actually performed.
We can see this using the previous query:
Even worse, if we change the upsert to set the value of
value
to 42 instead of usingval(inc)
a new UID will be created.Running this upsert:
upsert { query { q(func: has(value)) { value as value inc as math(value+1) } } mutation { set { uid(inc) <value> "42" . } } }
Instead of updating the previous value it created a new UID, as shown in the query below.
The text was updated successfully, but these errors were encountered: