fix: Embed views with different column ordering correctly
This fixes a regression introduced in d2719420f4.
The order of relColumns in the schema cache is now consistently matching the order of columns in foreign key definitions.
Resolves #2518
Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
This commit is contained in:
committed by
Wolfgang Walther
parent
ca338ae401
commit
2158f3d039
@@ -739,6 +739,9 @@ spec actualPgVersion = do
|
||||
{"tournament":"tournament_3","player_view":{"first_name":"first_name_3"}}] |]
|
||||
{ matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
it "works when embedding two views that refer to tables with different column ordering" $
|
||||
get "/v1?select=v2(*)" `shouldRespondWith` 200
|
||||
|
||||
it "can embed a view that has group by" $
|
||||
get "/projects_count_grouped_by?select=number_of_projects,client:clients(name)&order=number_of_projects" `shouldRespondWith`
|
||||
[json|
|
||||
|
||||
Vendored
+18
@@ -2859,3 +2859,21 @@ create or replace function jsbaz(fee) returns setof baz as $$
|
||||
join johnsmith js on js.baz_id = b.baz_id
|
||||
where js.fee_id = $1.fee_id
|
||||
$$ stable language sql;
|
||||
|
||||
|
||||
-- issue https://github.com/PostgREST/postgrest/issues/2518
|
||||
create table a (
|
||||
primary key (c1, c2),
|
||||
c1 int,
|
||||
c2 bool
|
||||
);
|
||||
|
||||
create table b (
|
||||
c2 bool,
|
||||
c1 int,
|
||||
foreign key (c1, c2) references a
|
||||
);
|
||||
|
||||
create view test.v1 as table test.a;
|
||||
|
||||
create view test.v2 as table test.b;
|
||||
|
||||
Reference in New Issue
Block a user