fix: Embed One-to-One relationship with different column order properly

This commit is contained in:
Wolfgang Walther
2024-07-13 22:26:36 +02:00
committed by Wolfgang Walther
parent 9d9233b061
commit 50bdb6a3de
3 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -783,7 +783,7 @@ allM2OandO2ORels =
JOIN LATERAL (
SELECT
array_agg(row(cols.attname, refs.attname) order by ord) AS cols_and_fcols,
jsonb_agg(cols.attname order by ord) AS cols
jsonb_agg(cols.attname order by cols.attnum) AS cols
FROM unnest(traint.conkey, traint.confkey) WITH ORDINALITY AS _(col, ref, ord)
JOIN pg_attribute cols ON cols.attrelid = traint.conrelid AND cols.attnum = col
JOIN pg_attribute refs ON refs.attrelid = traint.confrelid AND refs.attnum = ref