Closed Amila-Rukshan closed 2 months ago
This will not be a Supabase bug, but something going on with what you are doing and Postgres. There is no Supabase specific code involved. Going to move this to discussions, but you might also want to seek help in the broader Postgres community. You might also post your function declaration with parameters unless I missed it.
Bug report
Describe the bug
This is the database function:
If I have two entries for the
integration_connection
with the same email then there are two relatedconnection_id
values for them. Under this condition, the issue could be reproduced.As given in the query it uses
v_connection_id
(it is just read from jsonb input) to do check if it is already available.when the execution reaches the insertion below which is inside nested conditions as given:
what happens is
v_connection_id
has changed to the secondconnection_id
(from the second entry I mentioned above). It should never happen as we have never changed it when reaching to insertion.This is the table:
Workaround fix
I could use
email_obj->>'connection_id'
everywhere it is wanted for now.Expected behavior
This shouldn't happen as it was never changed once after the initial read.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
Additional context
Add any other context about the problem here.