Hi. Could somebody assist me with this issue?
# off-topic
j
Hi. Could somebody assist me with this issue?
s
Try using the full schema name with the table
public.mdThemes
and see if that works, also can you double check that your table name is correct.
j
table name is correct 🙂 I'll check with schema
as this service in code works
Copy code
async updateThemeObjectOnChange(themeId: string | null, themeStringifiedObject: string) {
    return await this.supabase
      .from('mdThemes')
      .update({ themeObject: themeStringifiedObject })
      .eq('id', themeId);
  }
I still have weird issue.
s
So its saying the function has already been created
j
if I set function name to
increment
it works fine, no issues there. But when I change function name here, first run returns success while every second run return such error
s
Yeah that's because the function exists already
You can drop the function and create it again using
Copy code
sql
drop function if exists public.incrementThemeSeen();
j
But if I run
Copy code
async updateThemeSeenOnPreview(themeId: string | null) {
    return await this.supabase.rpc('incrementThemeSeen', { row_id: themeId })
  }
I get 404 error in console If function name is called
increment
there are no errors at all.
So I am wondering why 404 if function exists
s
Drop the original function and create it again using the
public
schema part to it
Can you paste your create function here, not screenshot, that way it will be easier for me to give you the correct syntax
j
Copy code
create function incrementThemeSeen (row_id uuid) 
returns void as
$$
  update public."mdThemes" 
  set seen = seen + 1
  where id = row_id;
$$ 
language sql volatile;
s
Try this
Copy code
sql
drop function if exists public.incrementThemeSeen();

create function public.incrementThemeSeen (row_id uuid) 
returns void as
$$
  update public.mdThemes 
  set seen = seen + 1
  where id = row_id;
$$ 
language sql volatile;
The first line is dropping the function, then we create it in the public schema
j
Now I'm getting
function "incrementthemeseen" already exists with same argument types
s
Inside your Supabase Dashboard to to the Database section and click Functions, this should list all the functions you have created
Let me know if
incrementThemeSeen
is in there
j
there were only lowcapsed names
deleted them all, I'll try again
s
yeah its normally better to use
_
then camelCase
I tend to use underscore for everything in my database
j
Ok I found my issue
so when I create incrementThemeSeen it all goes lowcaps and creates it as incrementthemeseen .. so I have to call
incrementthemeseen
s
I would suggest using underscore for everything in your database
increment_theme_seen
j
yes I'll probably have to. Good thing this one is figured out 😄 Thanks for your help, seems like my code is working properly now
s
Ok happy to hear that