aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2020-05-02 01:25:00 +0200
committerTomas Vondra <tomas.vondra@postgresql.org>2020-05-02 01:33:51 +0200
commit60fbb4d762506c352c1af1229288a0753742cd95 (patch)
tree67b7bdfa3d6d1dbe9ffcead6c1ea3c6002730d84 /src
parent2e08d314ed07363636a5da65f2a3abf7135f8ba8 (diff)
downloadpostgresql-60fbb4d762506c352c1af1229288a0753742cd95.tar.gz
postgresql-60fbb4d762506c352c1af1229288a0753742cd95.zip
Simplify cost_incremental_sort a bit
Commit de0dc1a847 added code to cost_incremental_sort to handle varno 0. Explicitly removing the RelabelType is not really necessary, because the pull_varnos handles that just fine, which simplifies the code a bit. Author: Richard Guo Discussion: https://postgr.es/m/CAMbWs4_3_D2J5XxOuw68hvn0-gJsw9FXNSGcZka9aTymn9UJ8A%40mail.gmail.com Discussion: https://postgr.es/m/20200411214639.GK2228%40telsasoft.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/path/costsize.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index f5f9bae1a20..b10b14a7fb8 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -1842,9 +1842,6 @@ cost_incremental_sort(Path *path,
*/
foreach(l, pathkeys)
{
- Node *expr;
- Relids varnos;
-
PathKey *key = (PathKey *) lfirst(l);
EquivalenceMember *member = (EquivalenceMember *)
linitial(key->pk_eclass->ec_members);
@@ -1853,14 +1850,7 @@ cost_incremental_sort(Path *path,
* Check if the expression contains Var with "varno 0" so that we
* don't call estimate_num_groups in that case.
*/
- expr = (Node *) member->em_expr;
-
- if (IsA(expr, RelabelType))
- expr = (Node *) ((RelabelType *) expr)->arg;
-
- varnos = pull_varnos(expr);
-
- if (bms_is_member(0, varnos))
+ if (bms_is_member(0, pull_varnos((Node *) member->em_expr)))
{
unknown_varno = true;
break;