I'm trying to get query results aggregated into th...
# help
c
I'm trying to get query results aggregated into their own field because Zapier doesn't seem to handle an array as a response body... For this query
curl 'https://ixlqpcigbdlbmfnvzxtw.supabase.co/rest/v1/buyers?select=json_agg%28buyers%29'
I get
{"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 buyers and json_agg in the schema cache"}
and am wondering what I'm doing wrong. Works great in the sql editor. Many thanks!
s
Foreign keys error
It seems to be saying foreign keys are missing
c
Yeah
json_agg
is just a function though
I think I'm missing something on how PostgREST works
s
json_agg cannot be called in that way, PostgREST prevents arbitrary and slow queries from clients, see https://postgrest.org/en/v8.0/api.html#custom-queries
For this case, you might create a view or a function and call it through rpc https://supabase.io/docs/reference/javascript/rpc
c
@User awesome, thank you sir 🙏