Open mrkpatchaa opened 11 months ago
Could you assign this issue to me? I would like to work upon this.
@avi1737 I cannot assign. Maybe an admin can help with that.
.upsert(data, { onConflict: ['user_id', 'listing_id'], ignoreDuplicates: true })
IMO this behavior is pretty clear from the ignoreDuplicates: true
usage, I don't see how it's a bug.
You should remove ignoreDuplicates
or set it to false
if you want the result to be returned.
@steve-chavez when I set ignoreDuplicates to false, I get this
{
error: null,
data: null,
count: null,
status: 201,
statusText: 'Created'
}
Bug report
Describe the bug
Hi Team, when doing an upsert on an existing record, the select returns an empty array.
To Reproduce
This is my code
Running this the first time returns data
Running it second time with the same values for listing_id and user_id returns
Expected behavior
The second call should return the same result as the first one.
Additional context
If the behaviour is normal, how should I get the id of the newly inserted / existing row? Typically I would run this code and redirect the user to the chat screen with id returned in data. The idea is to not make an extra call to the database.