0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Supabase】「42501 permission denied for view (View名)」エラーの解消方法

Posted at

以前ハマったところで、もう一回ハマったので、備忘録として残しておきます

事象

View を作り直したところ、Supabase-jsでのselect結果として、以下のエラーが帰ってくるようになった

42501 permission denied for view (View名)

エラーの解消方法

以下のSQLを実行して、権限を付与する
Viewに対しての実行だが、~ ON table ~で実行する
tableの記載をviewに置き換えて実行すると構文エラーになる)

GRANT ALL ON table スキーマ名.View名 TO postgres;
GRANT ALL ON table スキーマ名.View名 TO anon;
GRANT ALL ON table スキーマ名.View名 TO authenticated;
GRANT ALL ON table スキーマ名.View名 TO service_role;

スキーマ名.View名は実行するViewの名称に置き換え

開発様に全権限を与えているので、必要に応じて設定は変更すること

テーブルにselectして、42501エラーが返ってくることがあるが、その場合の対処方法も同じ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?