burggraf / SupaScript

135 stars 6 forks source link

install error: Failed to run sql query: permission denied to set parameter "plv8.start_proc" #18

Open happyboy2022 opened 1 year ago

happyboy2022 commented 1 year ago

I copied the contents of the file EASY-INSTALL-V1.5.SQL into a Supabase SQL editor and executed it. However, I received an error: 'Failed to run SQL query: permission denied to set parameter "plv8.start_proc".' Upon reviewing the Supabase documentation, it appears that obtaining superuser access in Supabase isn't possible. Could you shed some light on this issue?

burggraf commented 1 year ago

I just spun up a new Supabase project and ran the EASY-INSTALL-V1.5.SQL in a query window, and it worked just fine for me. Is your project an older one, or have you modified the permissions for it?

happyboy2022 commented 1 year ago

Thank you very much for your response.

I found that when I created a new Supabase project, I was able to successfully execute EASY-INSTALL-V1.5.SQL the first time. However, when I tried to execute it again, I received the following error message: Failed to run SQL query: permission denied to set parameter "plv8.start_proc".

It appears that the command I ran the first time was: ALTER DATABASE POSTGRES SET PLV8.START_PROC TO 'supascript_init'; Although I have superuser privileges, I seem to have lost permission to run this command the second time. I am still struggling with this issue.

HarveySupper commented 1 year ago

Thank you for your answer, we found the problem is to execute the following code, after removing it, it can run normally. CREATE EXTENSION IF NOT EXISTS "plv8" WITH SCHEMA "pg_catalog";

burggraf commented 1 year ago

Awesome, @HarveySupper! Can you clarify the exact steps you're performing here so I can add this to the docs? I appreciate it!

HarveySupper commented 1 year ago

SET PLV8.START_PROC = 'supascript_init'; ALTER DATABASE POSTGRES SET PLV8.START_PROC TO 'supascript_init'; According to the current test situation, it should be that we do not have permission to change the value of PLV8.START_PROC, we can only initialize the setting once, and the second time the setting will prompt Failed to run SQL query: permission denied to set parameter "plv8.start_proc". So I executed the SET PLV8.START_PROC at the very beginning.

happyboy2022 commented 1 year ago

Yes, this can only be executed at the beginning of the initial project: ALTER DATABASE POSTGRES SET PLV8.START_PROC TO 'supascript_init'; Otherwise, an error will occur: Failed to run SQL query: permission denied to set parameter "plv8.start_proc". Also, this SQL code should be placed at the very beginning of the SQL migration file to ensure normal local development. Currently, I can use this as a temporary solution.

I am not sure if Supabase will fix this issue in future versions. If Supabase provides developers with a database account : postgre that has higher permissions, perhaps there won't be such problems.

In any case, thank you all for your assistance with this issue.