postgrest-docs
postgrest-docs copied to clipboard
Resource Embedding with Foreign Table Wrapper
PostgREST needs FOREIGN KEY constraints to be able to do Resource Embedding. What about foreign tables? Is it necessary to create a view in order to solve this issue?
I think you might be interested in reading:
- https://github.com/PostgREST/postgrest/issues/915#issuecomment-780035727
- https://github.com/PostgREST/postgrest/issues/1179
TLDR: Your best bet is to create a virtual column via function, that contains the embedding of the foreign table.
This is now documented on https://postgrest.org/en/stable/api.html#computed-relationships