diff options
author | Etsuro Fujita <efujita@postgresql.org> | 2021-05-13 20:00:00 +0900 |
---|---|---|
committer | Etsuro Fujita <efujita@postgresql.org> | 2021-05-13 20:00:00 +0900 |
commit | a784859f4480ceaa05a00ca35311071ca33483d1 (patch) | |
tree | 3ef98b825d3c73d0c5e4bc8109dac1b9456dc938 /contrib/postgres_fdw/sql/postgres_fdw.sql | |
parent | 5a73a9e3b5b24cf2dd90ab4a7ae3724b2c12a0cc (diff) | |
download | postgresql-a784859f4480ceaa05a00ca35311071ca33483d1.tar.gz postgresql-a784859f4480ceaa05a00ca35311071ca33483d1.zip |
Prevent asynchronous execution of direct foreign-table modifications.
Commits 27e1f1456 and 86dc90056, which were independently discussed,
cause a crash when executing an inherited foreign UPDATE/DELETE query
with asynchronous execution enabled, where children of an Append node
that is the direct/indirect child of the ModifyTable node are rewritten
so as to modify foreign tables directly by postgresPlanDirectModify();
as in that case the direct modifications are executed asynchronously,
which is not currently supported by asynchronous execution. Fix by
disabling asynchronous execution of the direct modifications in that
function.
Author: Etsuro Fujita
Reviewed-by: Amit Langote
Discussion: https://postgr.es/m/CAPmGK158e9sJOfuWxfn%2B0ynrspXQU3JhNjSCbaoeSzMvnga%2Bbw%40mail.gmail.com
Diffstat (limited to 'contrib/postgres_fdw/sql/postgres_fdw.sql')
-rw-r--r-- | contrib/postgres_fdw/sql/postgres_fdw.sql | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql index 53adfe2abc8..78379bdea5b 100644 --- a/contrib/postgres_fdw/sql/postgres_fdw.sql +++ b/contrib/postgres_fdw/sql/postgres_fdw.sql @@ -3237,6 +3237,14 @@ DROP TABLE base_tbl4; RESET enable_mergejoin; RESET enable_hashjoin; +-- Test that UPDATE/DELETE with inherited target works with async_capable enabled +EXPLAIN (VERBOSE, COSTS OFF) +UPDATE async_pt SET c = c || c WHERE b = 0 RETURNING *; +UPDATE async_pt SET c = c || c WHERE b = 0 RETURNING *; +EXPLAIN (VERBOSE, COSTS OFF) +DELETE FROM async_pt WHERE b = 0 RETURNING *; +DELETE FROM async_pt WHERE b = 0 RETURNING *; + -- Check EXPLAIN ANALYZE for a query that scans empty partitions asynchronously DELETE FROM async_p1; DELETE FROM async_p2; |