Commit 7dc1f83
committed
fix: PostgreSQL read methods and delete_entity_relation bugs
Why this change is needed:
After implementing model isolation, two critical bugs were discovered that would cause data access failures:
Bug 1: In delete_entity_relation(), the SQL query uses positional parameters
($1, $2) but the parameter dict was not converted to a list of values before
passing to db.execute(). This caused parameter binding failures when trying to
delete entity relations.
Bug 2: Four read methods (get_by_id, get_by_ids, get_vectors_by_ids, drop)
were still using namespace_to_table_name(self.namespace) to get legacy table
names instead of self.table_name with model suffix. This meant these methods
would query the wrong table (legacy without suffix) while data was being
inserted into the new table (with suffix), causing data not found errors.
How it solves it:
- Bug 1: Convert parameter dict to list using list(params.values()) before
passing to db.execute(), matching the pattern used in other methods
- Bug 2: Replace all namespace_to_table_name(self.namespace) calls with
self.table_name in the four affected methods, ensuring they query the
correct model-specific table
Impact:
- delete_entity_relation now correctly deletes relations by entity name
- All read operations now correctly query model-specific tables
- Data written with model isolation can now be properly retrieved
- Maintains consistency with write operations using self.table_name
Testing:
- All 6 PostgreSQL migration tests pass (test_postgres_migration.py)
- All 6 Qdrant migration tests pass (test_qdrant_migration.py)
- Verified parameter binding works correctly
- Verified read methods access correct tables1 parent ad68624 commit 7dc1f83
1 file changed
+6
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2604 | 2604 | | |
2605 | 2605 | | |
2606 | 2606 | | |
2607 | | - | |
2608 | | - | |
2609 | | - | |
| 2607 | + | |
| 2608 | + | |
2610 | 2609 | | |
2611 | 2610 | | |
2612 | 2611 | | |
| |||
2624 | 2623 | | |
2625 | 2624 | | |
2626 | 2625 | | |
2627 | | - | |
2628 | | - | |
2629 | | - | |
2630 | | - | |
2631 | | - | |
2632 | | - | |
2633 | | - | |
2634 | | - | |
| 2626 | + | |
2635 | 2627 | | |
2636 | 2628 | | |
2637 | 2629 | | |
| |||
2657 | 2649 | | |
2658 | 2650 | | |
2659 | 2651 | | |
2660 | | - | |
2661 | | - | |
2662 | | - | |
2663 | | - | |
2664 | | - | |
2665 | | - | |
2666 | | - | |
2667 | 2652 | | |
2668 | | - | |
| 2653 | + | |
2669 | 2654 | | |
2670 | 2655 | | |
2671 | 2656 | | |
| |||
2706 | 2691 | | |
2707 | 2692 | | |
2708 | 2693 | | |
2709 | | - | |
2710 | | - | |
2711 | | - | |
2712 | | - | |
2713 | | - | |
2714 | | - | |
2715 | | - | |
2716 | 2694 | | |
2717 | | - | |
| 2695 | + | |
2718 | 2696 | | |
2719 | 2697 | | |
2720 | 2698 | | |
| |||
2743 | 2721 | | |
2744 | 2722 | | |
2745 | 2723 | | |
2746 | | - | |
2747 | | - | |
2748 | | - | |
2749 | | - | |
2750 | | - | |
2751 | | - | |
2752 | | - | |
2753 | 2724 | | |
2754 | | - | |
| 2725 | + | |
2755 | 2726 | | |
2756 | 2727 | | |
2757 | 2728 | | |
| |||
0 commit comments