© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
NuggetPirate

Where do I insert a DB function to? getting syntax errors

Trying to insert the following function and getting syntax errors

create or replace function "CreateScrapedUpload" (
  _filename text,
  _record_count int,
) returns table (
  id uuid,
  filename text,
  storage_key text
  record_count int,
  notes text,
  checkbox boolean
) as $$
  insert into rr_upload (
    filename,
    storage_key,
    record_count,
    notes,
    checkbox,
  )
  select
    filename,
    extensions.uuid_generate_v4()
    _record_count
    _filename,
    "",
    false
  from public.rr_upload rr
  returning id, filename, storage_key;
$$ language sql volatile;
create or replace function "CreateScrapedUpload" (
  _filename text,
  _record_count int,
) returns table (
  id uuid,
  filename text,
  storage_key text
  record_count int,
  notes text,
  checkbox boolean
) as $$
  insert into rr_upload (
    filename,
    storage_key,
    record_count,
    notes,
    checkbox,
  )
  select
    filename,
    extensions.uuid_generate_v4()
    _record_count
    _filename,
    "",
    false
  from public.rr_upload rr
  returning id, filename, storage_key;
$$ language sql volatile;


Error:
Failed to create function: failed to create pg.functions: syntax error at or near ")"
Failed to create function: failed to create pg.functions: syntax error at or near ")"
unknown.png
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

DB Function to Insert New Users
SupabaseSSupabase / help-and-questions
4y ago
Function syntax error
SupabaseSSupabase / help-and-questions
4y ago
Auth errors and db errors
SupabaseSSupabase / help-and-questions
3mo ago
Where do I put shared code in Edge Function?
SupabaseSSupabase / help-and-questions
7mo ago