fix: Embedding views with partial FK references broken

This is a regression introduced in d2719420f4.

Fixes #2548

Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
This commit is contained in:
Wolfgang Walther
2022-10-31 18:15:06 +01:00
committed by Wolfgang Walther
parent b2935ef799
commit 44dd73adcc
4 changed files with 28 additions and 1 deletions
@@ -563,3 +563,6 @@ spec =
}
]|]
{ matchHeaders = [matchContentTypeJson] }
it "should not expose hidden FKs" $
get "/va?select=vb(*)" `shouldRespondWith` 200
+16
View File
@@ -2980,3 +2980,19 @@ select parent.parent as grandparent,
join public.i2459_self_t as child
on child.parent = parent.id
where child.type = 'B';
-- issue https://github.com/PostgREST/postgrest/issues/2548
CREATE TABLE public.ta (
a1 INT PRIMARY KEY,
a2 INT,
UNIQUE (a1, a2)
);
CREATE TABLE public.tb (
b1 INT REFERENCES public.ta (a1),
b2 INT,
FOREIGN KEY (b1, b2) REFERENCES public.ta (a1, a2)
);
CREATE VIEW test.va AS SELECT a1 FROM public.ta;
CREATE VIEW test.vb AS SELECT b1 FROM public.tb;