Design many-to-many join table with additional column
2
votes
2
answers
703
views
I have
product
and documentation
tables and want to hava a many-to-many relationship between them with an additional condition.
The tables look like this:
create table product (
id bigserial primary key
);
create table documentation (
id bigserial primary key,
type text not null
);
And condition is: each product can have any number of documentation but no more than 1 of each type.
Is it possible to create such a constraint without addading a type
column into the join table?
Asked by abobov
(21 rep)
Apr 16, 2023, 11:35 AM
Last activity: Feb 17, 2025, 01:02 PM
Last activity: Feb 17, 2025, 01:02 PM