New !inner join not working: "Could not find a relationship between trips and bookings in the schema cache"
See original GitHub issueBug report
Describe the bug
I follow the syntax explained here: https://postgrest.org/en/v9.0/api.html#embedding-with-top-level-filtering
I am attempting to utilize the new inner join functionality. I attempt to perform a simple query. If I leave out “!inner” it works well, however, with “!inner”, I get an error:
{
"hint": "If a new foreign key between these entities was created in the database, try reloading the schema cache.",
"message": "Could not find a relationship between trips and bookings in the schema cache"
}
Example:
- Works = https://__.supabase.co/rest/v1/trips?select=bookings(id)
- Does not works = https://__.supabase.co/rest/v1/trips?select=bookings!inner(id)
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Try similar queries as above
Expected behavior
I would expect, when not giving any filters to the query, to get the exact same response as if not including “!inner” in the query.
System information
- Happens both using the Javascript SDK and through direct REST calls in Postman
Additional context
- I have tried with multiple different relations in our setup. All of them behave the same.
- I have attempted to restart our Supabase server in the cloud dashboard but that made zero difference.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
New !inner join not working: "Could not find a relationship ...
New !inner join not working: "Could not find a relationship between trips and bookings in the schema cache" #232.
Read more >"Could not find a relationship" error : r/Supabase - Reddit
But I get this error: "Could not find a relationship between 'location' and 'facility_category' in the schema cache".
Read more >How to fix error Base table or view not found - Stack Overflow
It seems Laravel is trying to use category_posts table (because of many-to-many relationship). But you don't have this table, because you've ...
Read more >SQL JOIN TABLES: Working with Queries in SQL Server
The INNER JOIN query retrieves records from only those rows of both the tables in the JOIN query, where there is a match...
Read more >Writing query results | BigQuery - Google Cloud
Access to the temporary table data is restricted to the user or service account that created the query job. You cannot share temporary...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mbalslow Yes, that’s intended behavior - does an INNER JOIN under the hood - it excludes top-level rows without an explicit filter(actually it contains an implicit filter, the ON clause of the INNER JOIN).
True. Actually on the PostgREST side we are thinking of adding an alternative way to specify this operation, which would enable doing:
Or through
postgrest-js
:I think that would make the filtering more explicit.
@steve-chavez I can confirm that it now works so it was simply a matter of time until the instance was upgraded