© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
jon.m

RPC Call Returns Zero Rows But Function Works as Expected

I'm using a function to return user profile data. When using the function in the SQL editor, it returns the proper information. But when using RPC, it doesn't work out, and the return data array is empty.

CREATE OR REPLACE FUNCTION fetch_user_details(usersid uuid)
RETURNS table(
user_detail_id bigint, 
user_id uuid, 
full_name text,
user_email text,
org_id bigint, 
org_name text
) AS
$$
BEGIN 
   RETURN QUERY
   SELECT 
   u.id, 
   u.user_id,
   u.full_name,
   u.user_email,
   o.id,
   o.org_name

   FROM user_details u
   INNER JOIN org_details o
   ON u.org_id = o.id
   WHERE u.user_id = usersid;
   END
$$
language plpgsql;
CREATE OR REPLACE FUNCTION fetch_user_details(usersid uuid)
RETURNS table(
user_detail_id bigint, 
user_id uuid, 
full_name text,
user_email text,
org_id bigint, 
org_name text
) AS
$$
BEGIN 
   RETURN QUERY
   SELECT 
   u.id, 
   u.user_id,
   u.full_name,
   u.user_email,
   o.id,
   o.org_name

   FROM user_details u
   INNER JOIN org_details o
   ON u.org_id = o.id
   WHERE u.user_id = usersid;
   END
$$
language plpgsql;
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

rpc call returns a serialization error in kotlin
SupabaseSSupabase / help-and-questions
3y ago
DB function cannot be searched via RPC call
SupabaseSSupabase / help-and-questions
13mo ago
Request that returns random rows
SupabaseSSupabase / help-and-questions
4y ago
Timeout on RPC Call
SupabaseSSupabase / help-and-questions
3mo ago