Commit 46759fc
committed
Fix INSERT EXEC stale OID errors by closing target table before clearing context
During major version upgrade tests, BABEL-1944 was failing with could not
open relation with OID errors. The root cause was that error cleanup paths
were calling pltsql_clear_insert_exec_context() WITHOUT first calling
pltsql_insert_exec_close_target_table(), leaving insert_exec_target_rel_oid
set to a stale OID.
Fix: Add pltsql_insert_exec_close_target_table() calls before
pltsql_clear_insert_exec_context() in all error cleanup paths:
- iterative_exec.c: No TRY-CATCH cleanup path in !IsTransactionBlockActive
- iterative_exec.c: TRY-CATCH cleanup path in exec_stmt_iterative
- pl_exec-2.c: exec_stmt_try_catch cleanup
This ensures the target table OID is properly cleared and the lock is
released before the INSERT EXEC context is cleared.1 parent 8f14a6e commit 46759fc
2 files changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1490 | 1490 | | |
1491 | 1491 | | |
1492 | 1492 | | |
| 1493 | + | |
1493 | 1494 | | |
1494 | 1495 | | |
1495 | 1496 | | |
| |||
1544 | 1545 | | |
1545 | 1546 | | |
1546 | 1547 | | |
| 1548 | + | |
1547 | 1549 | | |
1548 | 1550 | | |
1549 | 1551 | | |
| |||
1791 | 1793 | | |
1792 | 1794 | | |
1793 | 1795 | | |
1794 | | - | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
1795 | 1800 | | |
1796 | 1801 | | |
1797 | 1802 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2922 | 2922 | | |
2923 | 2923 | | |
2924 | 2924 | | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
2925 | 2928 | | |
2926 | 2929 | | |
2927 | 2930 | | |
| |||
0 commit comments