Javascript Reference v2.0

Call a Postgres function

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.

Parameters
    fn
    REQUIRED
    FnName

    The function name to call

    args
    Optional
    object

    The arguments to pass to the function call

    options
    Optional
    object

    Named parameters


const { data, error } = await supabase.rpc('hello_world')