Perform a function call.
You can call Postgres functions as Remote Procedure Calls, logic in your database that you can execute from anywhere. Functions are useful when the logic rarely changes—like for password resets and updates.
create or replace function hello_world() returns text as $$
select 'Hello world';
$$ language sql;
To call Postgres functions on Read Replicas, use the get: true
option.
The function name to call
The arguments to pass to the function call
Named parameters
const \{ data, error \} = await supabase.rpc('hello_world')
const \{ data, error \} = await supabase.rpc('echo', \{ say: 'đź‘‹' \})
const \{ data, error \} = await supabase.rpc('add_one_each', \{ arr: [1, 2, 3] \})
const \{ data, error \} = await supabase
.rpc('list_stored_countries')
.eq('id', 1)
.single()
const \{ data, error \} = await supabase.rpc('hello_world', \{ get: true \})