DependencyTrack / DependencyTrack/dependency-track

Missing index causes errors when attempting to delete objects

Open
#4,881 1 comment 0 reactions 0 assignees View on GitHub
defect p2 size/M technical debt
Dominant language
Java
Stars
4.2k
Forks
811
Avg merge
8h 39m
Merged PRs (30d)
237

Description

### Current Behavior

I (and another user in OWASP Slack) have mentioned seeing database errors when trying to delete objects in Dependency Track. The UI just gives a generic error, and when you look at database logs you will see an error such as:
```
Caused by: org.postgresql.util.PSQLException: ERROR: cannot delete from table "COMPONENTS_VULNERABILITIES" because it does not have a replica identity and publishes deletes

Hint: To enable deleting from the table, set REPLICA IDENTITY using ALTER TABLE.
```

I experienced this when trying to delete a tag, but the error was for the `NOTIFICATIONRULE_TAGS` table.

Setting `replica identity` to `full` works as a band-aid solution (in both of the cases above), but I believe the better fix would be to add an index to these tables. (Por que no los dos?)

I suspect this is only an issue on a handful of tables where deletes are very rarely performed. It may also be tied to a more recent version of Dependency Track and/or Postgres version (around the time I experienced this I upgraded from 15 to 17), as I have deleted tags in the past without issue.

### Steps to Reproduce

1. Create a tag.
2. Delete a tag.

### Expected Behavior

Tag (or other object) deletes successfully.

### Dependency-Track Version

4.13.0

### Dependency-Track Distribution

Container Image

### Database Server

PostgreSQL

### Database Server Version

POSTGRES_17_4.R20250302.00_07

### Browser

N/A

### Checklist

- [x] I have read and understand the [contributing guidelines](https://github.com/DependencyTrack/dependency-track/blob/master/CONTRIBUTING.md#filing-issues)
- [x] I have checked the [existing issues](https://github.com/DependencyTrack/dependency-track/issues) for whether this defect was already reported

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.