© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
14 replies
I am not mr. Artem!

Func and Triggers

Hi, kind people! Trying to find out - how to write functions and triggers in Supabase. Can anybody help me with finding solution?

I have a table named "records" and couple of buckets with some assets. My goal is to write the trigger on record deletion to delete related assets - they have record id in the name.

I wrote this kind of thing:

CREATE OR REPLACE FUNCTION public.storage_assets_deletion()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
begin
    DELETE FROM 
    storage.objects
        WHERE name LIKE '%' "concat" records.id "concat" '%';
return null;
end;
$function$

"concat" is ||

but it throws an error - PostgrestError(details: nil, hint: nil, code: Optional("42P01"), message: "missing FROM-clause entry for table "records"")

What am I doing wrong? And what to do to achieve my goal?
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

List triggers and their content
SupabaseSSupabase / help-and-questions
4mo ago
Postgres triggers
SupabaseSSupabase / help-and-questions
4y ago
triggers and functions behave like transactions?
SupabaseSSupabase / help-and-questions
4y ago
Minimize Edge func memory techniques
SupabaseSSupabase / help-and-questions
8mo ago