fix: Embed One-to-One relationship with different column order properly
This commit is contained in:
committed by
Wolfgang Walther
parent
9d9233b061
commit
50bdb6a3de
@@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- #3091, Broken link in OpenAPI description `externalDocs` - @salim-b
|
- #3091, Broken link in OpenAPI description `externalDocs` - @salim-b
|
||||||
|
- #3659, Embed One-to-One relationship with different column order properly - @wolfgangwalther
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
@@ -783,7 +783,7 @@ allM2OandO2ORels =
|
|||||||
JOIN LATERAL (
|
JOIN LATERAL (
|
||||||
SELECT
|
SELECT
|
||||||
array_agg(row(cols.attname, refs.attname) order by ord) AS cols_and_fcols,
|
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)
|
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 cols ON cols.attrelid = traint.conrelid AND cols.attnum = col
|
||||||
JOIN pg_attribute refs ON refs.attrelid = traint.confrelid AND refs.attnum = ref
|
JOIN pg_attribute refs ON refs.attrelid = traint.confrelid AND refs.attnum = ref
|
||||||
|
|||||||
Vendored
+1
-1
@@ -2839,7 +2839,7 @@ CREATE TABLE test.students_info(
|
|||||||
, code text
|
, code text
|
||||||
, address text
|
, address text
|
||||||
, primary key(id, code)
|
, primary key(id, code)
|
||||||
, foreign key (id, code) references test.students(id, code) on delete cascade
|
, foreign key (code, id) references test.students(code, id) on delete cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE test.country(
|
CREATE TABLE test.country(
|
||||||
|
|||||||
Reference in New Issue
Block a user