PostgREST not recognizing tables, functions, or views in an exposed schema
PostgREST is returning errors by not recognizing the objects(tables/functions/views) in a schema and logging errors similar to:
Could not find the table 'X' in the schema cacheWhy this happens
When multiple schemas are exposed, the first entry in the list is treated as the default, so PostgREST resolves unqualified object names only against that schema.
This behavior is intentional, as it prevents conflicts when different schemas contain objects with the same name.
How to fix this
If you want to use the objects without specifying a schema, you’d need to put it first. Else, you should initialise the Supabase client with the schema(”With custom schemas”) or specify the schema on each request using “.schema(‘your_schema’)” (“Switching schemas per query”)
Related topics
- PostgREST error codes
- PGRST106: The schema must be one of the following
- Refresh the PostgREST schema cache
- PostgREST not recognizing new columns or functions