Perhaps this is more a feature request than a bug.
I've noticed that Postgrest gives a 'No relationship found error' if a foreign key references a table from another schema.
Is Postgrest any close to support this feature? I am aware that it would imply to load the schema of the referenced table and so on. Still, maybe if the embedding url specified the embedded columns this would be an easy addition.
Thanks.
This already works. Create a view of the table in the unexposed schema in your api schema. Example:
create table private.people(
id int primary key,
name text
);
insert into private.people values(1, 'Pedro');
create table api.details(
id int,
phone text,
person_id int references private.people(id)
);
insert into api.details values(1, '888-8888', 1);
create view api.people as
select id, name from private.people;
curl "http://localhost:3000/details?select=id,phone,person:people(id,name)"
[{"id":1,"phone":"888-8888","person":{"id":1,"name":"Pedro"}}]
What does the "person" accomplish in this example curl command "person:people"? Is a colon and period interchangable in this situation?
@BrandonChubb In that case person is just an alias. Not interchangeable with a period since that's used for the feature introduced in https://github.com/PostgREST/postgrest/pull/918
Moving the issue to docs https://github.com/PostgREST/postgrest-docs/issues/219.
Most helpful comment
This already works. Create a view of the table in the unexposed schema in your
apischema. Example: