Table DDL:
CREATE TABLE entities_patents (
entity_id INTEGER REFERENCES entities(entity_id) NOT NULL,
patent_id INTEGER REFERENCES patents (patent_id) NOT NULL,
doc_number text NOT NULL,
created_at timestamp with time zone DEFAULT current_timestamp,
updated_at timestamp with time zone DEFAULT current_timestamp,
deleted boolean,
PRIMARY KEY (entity_id, patent_id)
);
Unfortunately there are duplicates in the table and I could not add the pk constraint previously. Trying to do so now leads to:
DETAIL: Key (entity_id, patent_id)=(123123, 811231333) is duplicated.
Is there a way to delete these duplicates?