diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2024-12-10 17:17:28 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2024-12-10 17:17:28 -0500 |
commit | 982890530379235974a7e99fd72e862ae40f1400 (patch) | |
tree | c94677fa488822e069c88ba83e1f34d596a40eaa /src | |
parent | 8b9cbf4922756d912309567f83f81e41f1737ac7 (diff) | |
download | postgresql-982890530379235974a7e99fd72e862ae40f1400.tar.gz postgresql-982890530379235974a7e99fd72e862ae40f1400.zip |
Doc: add some commentary about ExecutorRun's NoMovement special case.
Robert Haas expressed concern about whether commit 3eea7a0c9 exposed
the parallel-execution machinery to a case it isn't tested for, namely
a second non-parallel execution of a plan after a parallel execution.
Investigation shows that that can't happen because of pquery.c's
manipulation of the scan direction, but it sure wasn't obvious to
start with. Add some commentary about that.
Discussion: https://postgr.es/m/CA+TgmoagyKQy=HFw+wLo0AKTYWHui+iKswZ8Jnqqd-cFby-WVg@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/executor/execMain.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 13f3fcdaee9..1c12d6ebff0 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -348,7 +348,16 @@ standard_ExecutorRun(QueryDesc *queryDesc, dest->rStartup(dest, operation, queryDesc->tupDesc); /* - * run plan + * Run plan, unless direction is NoMovement. + * + * Note: pquery.c selects NoMovement if a prior call already reached + * end-of-data in the user-specified fetch direction. This is important + * because various parts of the executor can misbehave if called again + * after reporting EOF. For example, heapam.c would actually restart a + * heapscan and return all its data afresh. There is also some doubt + * about whether a parallel plan would operate properly if an additional, + * necessarily non-parallel execution request occurs after completing a + * parallel execution. (That case should work, but it's untested.) */ if (!ScanDirectionIsNoMovement(direction)) ExecutePlan(queryDesc, |