Commit 57f376d
committed
fix: Fix cascade delete for multi-column FKs and renamed attributes
Two critical fixes for PostgreSQL cascade delete:
1. Fix PostgreSQL constraint info query to properly match FK columns
- Use referential_constraints to join FK and PK columns by position
- Previous query returned cross product of all columns
- Now returns correct matched pairs: (fk_col, parent_table, pk_col)
2. Fix Heading.select() to preserve table_info (adapter context)
- Projections with renamed attributes need adapter for quoting
- New heading now inherits table_info from parent heading
- Prevents fallback to backticks on PostgreSQL
All cascade delete tests now passing:
- test_simple_cascade_delete[postgresql] ✅
- test_multi_level_cascade_delete[postgresql] ✅
- test_cascade_delete_with_renamed_attrs[postgresql] ✅
All unit tests passing (212/212).
All multi-backend tests passing (4/4).1 parent 338e7ea commit 57f376d
2 files changed
+17
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
668 | 668 | | |
669 | 669 | | |
670 | 670 | | |
671 | | - | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
672 | 677 | | |
673 | 678 | | |
674 | 679 | | |
675 | 680 | | |
676 | 681 | | |
677 | 682 | | |
678 | | - | |
679 | | - | |
680 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
681 | 690 | | |
682 | 691 | | |
683 | 692 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
608 | 611 | | |
609 | 612 | | |
610 | 613 | | |
| |||
0 commit comments