Scope Isolation of Session Variables in Supabase Edge Functions using createClient

I am currently working on a project using Supabase and have a specific implementation scenario involving PostgreSQL session variables. My setup involves setting a session variable (current_api_key) using the set_config function in PostgreSQL at the start of a database operation. This operation is initiated from an edge function where I use createClient to interact with the Supabase database. My question is about the scope and isolation of this session variable in the context of Supabase's serverless and connection-pooled environment:

Does Supabase ensure that a session variable set in a PostgreSQL function is confined to the scope of a single instance of createClient used within an edge function? In other words, when I set a session variable like current_api_key during a database operation triggered by an API request via createClient, will this session variable be isolated to just that operation and that specific createClient instance? I want to be certain that the session variable does not persist, bleed over, or affect other instances or subsequent requests, especially given the nature of serverless functions and connection pooling.
Was this page helpful?