© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•5mo ago•
1 reply
White Frost

permission denied for schema public. 2 hours trying to solve it.

Hello everyona!

I'm working on an MVP and started integrating my backend with Supabase. However, after a lot of frustration, I decided to simplify things and ended up creating a file called
supabase_ping.py
supabase_ping.py
to test why my select query isn’t working.

I’ve tested both the anon API key and the service API key, but in both cases I get a permission denied for schema public error. I’ve tried so many different things, but nothing has worked. The most informative error messages I’ve gotten are the following (the table name is messages, located at public.messages):

WARN: Query to 'messages' failed. Table may not exist or permissions denied.
Exception: Error 42501:
Message: permission denied for schema public
WARN: Query to 'messages' failed. Table may not exist or permissions denied.
Exception: Error 42501:
Message: permission denied for schema public


When I check the official troubleshooting page for this error: https://supabase.com/docs/guides/troubleshooting/database-api-42501-errors It shows this query:
select
  cast(postgres_logs.timestamp as datetime) as timestamp,
  event_message,
  parsed.error_severity,
  parsed.user_name,
  parsed.query,
  parsed.detail,
  parsed.hint
from
  postgres_logs
  cross join unnest(metadata) as metadata
  cross join unnest(metadata.parsed) as parsed
where
  regexp_contains(parsed.error_severity, 'ERROR|FATAL|PANIC')
  and parsed.sql_state_code = '42501'
order by timestamp desc
limit 100;
select
  cast(postgres_logs.timestamp as datetime) as timestamp,
  event_message,
  parsed.error_severity,
  parsed.user_name,
  parsed.query,
  parsed.detail,
  parsed.hint
from
  postgres_logs
  cross join unnest(metadata) as metadata
  cross join unnest(metadata.parsed) as parsed
where
  regexp_contains(parsed.error_severity, 'ERROR|FATAL|PANIC')
  and parsed.sql_state_code = '42501'
order by timestamp desc
limit 100;


Returns this error:
ERROR:  42P01: relation "postgres_logs" does not exist
LINE 10:   postgres_logs
ERROR:  42P01: relation "postgres_logs" does not exist
LINE 10:   postgres_logs


I assumed postgres_logs would be a pre-built table.

What can I do?
supabase_ping.py2.63KB
Supabase Docs | Troubleshooting | Database API 42501 errors
Supabase is the Postgres development platform providing all the backend features you need to build a product.
Supabase Docs | Troubleshooting | Database API 42501 errors
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Permission denied to schema public (403 error)
SupabaseSSupabase / help-and-questions
4mo ago
ERROR: permission denied for schema public (SQLSTATE 42501)
SupabaseSSupabase / help-and-questions
5mo ago
Permission denied for schema citext
SupabaseSSupabase / help-and-questions
13mo ago
Trigger on auth.users causes permission denied for schema public
SupabaseSSupabase / help-and-questions
3y ago