Resource embedding on an RPC function #4648
|
I have an RPC function endpoint that looks like this (simplified): I want to do a JOIN with another table in order to filter the results based on a column from that other table. The docs on Resource Embedding state that "For table-valued functions, it generates a join condition based on the foreign key columns of the returned table type". But I don't exactly understand what this means (what foreign key columns are in this context). I tried the obvious thing with i.e. I tried to join a How can I accomplish my objective? |
Replies: 1 comment 6 replies
|
@BorislavZlatanov Change the return type from |
@BorislavZlatanov Change the return type from
RETURNS TABLE (post_title TEXT)toRETURNS SETOF pollsand then the request should work. For this you'll also need to change toSELECT *inside the function.