aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeTidscan.c
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2020-02-07 22:00:21 +0900
committerFujii Masao <fujii@postgresql.org>2020-02-07 22:06:31 +0900
commitcb5b28613d553b1c750622e91cbc96c83f052a63 (patch)
treeed637bea7fecde465242cca5f1ec655e144f3278 /src/backend/executor/nodeTidscan.c
parentb059d2f45685a946da061ee15692fa306bd67f12 (diff)
downloadpostgresql-cb5b28613d553b1c750622e91cbc96c83f052a63.tar.gz
postgresql-cb5b28613d553b1c750622e91cbc96c83f052a63.zip
Fix bug in Tid scan.
Commit 147e3722f7 changed Tid scan so that it calls table_beginscan() and uses the scan option for seq scan. This change caused two issues. (1) The change caused Tid scan to take a predicate lock on the entire relation in serializable transaction even when relation-level lock is not necessary. This could lead to an unexpected serialization error. (2) The change caused Tid scan to increment the number of seq_scan in pg_stat_*_tables views even though it's not seq scan. This could confuse the users. This commit adds the scan option for Tid scan and makes Tid scan use it, to avoid those issues. Back-patch to v12, where the bug was introduced. Author: Tatsuhito Kasahara Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Fujii Masao Discussion: https://postgr.es/m/CAP0=ZVKy+gTbFmB6X_UW0pP3WaeJ-fkUWHoD-pExS=at3CY76g@mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeTidscan.c')
-rw-r--r--src/backend/executor/nodeTidscan.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index 16802b813d2..f0d4883e687 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -143,9 +143,8 @@ TidListEval(TidScanState *tidstate)
*/
if (tidstate->ss.ss_currentScanDesc == NULL)
tidstate->ss.ss_currentScanDesc =
- table_beginscan(tidstate->ss.ss_currentRelation,
- tidstate->ss.ps.state->es_snapshot,
- 0, NULL);
+ table_beginscan_tid(tidstate->ss.ss_currentRelation,
+ tidstate->ss.ps.state->es_snapshot);
scan = tidstate->ss.ss_currentScanDesc;
/*