Select referenced table in different schema #28474
-
|
Hi, I was trying to select referenced table in other schema.
when I select referenced table in different schema, it throw error. // try 1
const { data, error } = await supabase
.schema("clients")
.from("users")
.select(
`*, sellers( likes( ecommerce.products(*)))`
)
// try 2
const { data, error } = await supabase
.schema("clients")
.from("users")
.select(
`*, sellers( likes(products(*)))`
)
// error 1
{
"code": "PGRST100",
"details": "unexpected \"p\" expecting \"sum\", \"avg\", \"count\", \"max\" or \"min\"",
"hint": null,
"message": "\"failed to parse select parameter (*,sellers(likes(ecommerce.products(*))))\" (line 1, column 70)"
}
// error 2
{
"code": "PGRST200",
"details": "Searched for a foreign key relationship between 'likes' and 'products' in the schema 'clients', but no matches were found.",
"hint": null,
"message": "Could not find a relationship between 'likes' and 'products' in the schema cache"
}https://github.com/orgs/supabase/discussions/6550 I found this discussion, but I can't believe that you all work with only one schema. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The rest API only works on one schema at a time. It is in an http header which one will be used. You can use an rpc call to a Postgres function or a view to handle multiple schemas would be other approaches. |
Beta Was this translation helpful? Give feedback.
The rest API only works on one schema at a time. It is in an http header which one will be used.
You can use an rpc call to a Postgres function or a view to handle multiple schemas would be other approaches.