Skip to content

[regression] many-to-many relationships (FK-only, no or different PK) #2751

Answered by laurenceisla
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, this change was included in version 10.0.0 as mentioned in the CHANGELOG:

postgrest/CHANGELOG.md

Lines 196 to 197 in ce378e6

- #2070, Restrict generated many-to-many relationships - @steve-chavez
+ A primary key that contains the foreign key columns is now needed for generating many-to-many relationships.

This means that for a many-to-many relationship to be detected, the intermediate table must contain the foreign keys as primary keys. In your example, adding this constraint will make the embedding work as you expect:

alter table api.test_mapping add constraint test_mapping_pk primary key (id_a, id_b);

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ghost
Comment options

@laurenceisla
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #2748 on April 14, 2023 02:29.