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:
Wolfgang Walther
2022-10-24 16:49:32 +02:00
committed by Wolfgang Walther
parent ca338ae401
commit 2158f3d039
4 changed files with 32 additions and 6 deletions
+18
View File
@@ -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;