-
fix: fix issues in sqlite and postgres when dataset name is reused (#2579)
发布于
2026-04-14 15:21:54 +00:00 Description
This PR fixes an issue we had in the following execution flow:
cognee.add(dataset_name="test") -> delete_dataset(test) -> cognee.add(dataset_name="test")When we tried to add documents to the same dataset name as a previously
deleted dataset, we had connection errors in postgres. This was coming
from stale engine and connection pools towards the deleted dataset.Similar issue with SQLite, the foreign key enforcement is off by
default, so it caused an issue where the entries in the
dataset_databasewere not deleted properly, causing old (deleted)
datasets to return even after deletion.Acceptance Criteria
Type of Change
- Bug fix (non-breaking change that fixes an issue)
- New feature (non-breaking change that adds functionality)
- Code refactoring
- Other (please specify):
Screenshots
Pre-submission Checklist
- I have tested my changes thoroughly before submitting this PR
(SeeCONTRIBUTING.md) - This PR contains minimal changes necessary to address the
issue/feature - My code follows the project's coding standards and style
guidelines - I have added tests that prove my fix is effective or that my
feature works - I have added necessary documentation (if applicable)
- All new and existing tests pass
- I have searched existing PRs to ensure this change hasn't been
submitted already - I have linked any relevant issues in the description
- My commits have clear and descriptive messages
DCO Affirmation
I affirm that all code in every commit of this pull request conforms to
the terms of the Topoteretes Developer Certificate of Origin.Summary by CodeRabbit
- Bug Fixes
- Centralized vector DB engine initialization to improve connection
reliability and pooling. - Guaranteed disposal/cleanup of maintenance DB connections to prevent
resource leaks during create/delete operations. - Enforced SQLite foreign keys during delete operations so related
records are correctly honored and removed.
下载附件