Closed bobmcwhirter closed 3 months ago
Hm, that feels a bit drastic. Maybe necessary. Maybe there's a way to transform this indeed into an upsert, which should achieve the same? Anyway, I defer to @JimFuller-RedHat when it comes to DB stuff like that.
As long as the ORM produces something like the following sql:
ALTER TABLE your_table ADD CONSTRAINT constraint_name UNIQUE (your_column);
that adds a unique constraint on the column ... we should be good.
Agree with @ctron eg. would reccommend to avoid explicitly exclusive locking of the table ... this can cause all sorts of surprising performance issues in read/write scenarios - pg, by default, handles locking at various levels and should just 'do the right thing' with the defined unique constraint.
Wrong solution.
Add an EXCLUSIVE lock while ingesting vuln identifiers to prevent us from getting into an error state neeedlessly.
Fixes #471