You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd expect this to do two separate operations: update mytable set a = 1 where id = 1, then update mytable set a = 2 where id = 2. What actually happens is the second operation is the equivalent of update mytable set a = 2 where id = 1 and id = 2, resulting in nothing being updated. Request logs show the search string for the PATCH request as ?id=eq.1&id=eq.2.
Expected behavior
The two operations on table should be independent, and not affect each other.
Screenshots
N/A
System information
OS: N/A
Browser: Tested on Chrome
Version of supabase-js: 2.48.1 / postgrest-js 1.18.1
Version of Node.js: N/A
Additional context
There is a simple workaround - refactor the code as follows:
Bug report
Describe the bug
Multiple operations on the same "table" (PostgrestQueryBuilder instance) share state unexpectedly. If this is by design, it should be documented.
To Reproduce
Run the following code:
I'd expect this to do two separate operations:
update mytable set a = 1 where id = 1
, thenupdate mytable set a = 2 where id = 2
. What actually happens is the second operation is the equivalent ofupdate mytable set a = 2 where id = 1 and id = 2
, resulting in nothing being updated. Request logs show the search string for the PATCH request as?id=eq.1&id=eq.2
.Expected behavior
The two operations on
table
should be independent, and not affect each other.Screenshots
N/A
System information
Additional context
There is a simple workaround - refactor the code as follows:
It's difficult to tell whether this behavior is by design or a bug. But it's definitely not expected, and leads to difficult-to-debug issues.
I also tested the Dart postgrest package, and there the same code does work as expected (two independent operations).
I tested with
update
specifically, but I assume other operations such asselect
will likely have the same issue.The text was updated successfully, but these errors were encountered: