I need to make a category tree where some leafs can have multiple parents, for exaple
g \--b \--a c \--d \--a
above category 'a' has two parents(g and c)
My first attempt was to create the following table
create table catalogcategories2 ( id serial, name text not null, pid int null, primary key(id,pid), CONSTRAINT catalogcategories_fk FOREIGN KEY (pid) REFERENCES catalogcategories2(id) );
where both parent id and id are primary keys but I get the following error
there is no unique constraint matching given keys for referenced table "catalogcategories2"