Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0044f45

Browse files
committed
Ignore extra subquery outputs in set_subquery_size_estimates().
In commit0f61d4d, I added code to copy upcolumn width estimates for each column of a subquery. That code supposedthat the subquery couldn't have any output columns that didn't correspondto known columns of the current query level --- which is true when a queryis parsed from scratch, but the assumption fails when planning a view thatdepends on another view that's been redefined (adding output columns) sincethe upper view was made. This results in an assertion failure or even acrash, as per bug #8025 from lindebg. Remove the Assert and instead skipthe column if its resno is out of the expected range.
1 parent4d001c3 commit0044f45

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/backend/optimizer/path/costsize.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3700,6 +3700,15 @@ set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
37003700
if (te->resjunk)
37013701
continue;
37023702

3703+
/*
3704+
* The subquery could be an expansion of a view that's had columns
3705+
* added to it since the current query was parsed, so that there are
3706+
* non-junk tlist columns in it that don't correspond to any column
3707+
* visible at our query level. Ignore such columns.
3708+
*/
3709+
if (te->resno<rel->min_attr||te->resno>rel->max_attr)
3710+
continue;
3711+
37033712
/*
37043713
* XXX This currently doesn't work for subqueries containing set
37053714
* operations, because the Vars in their tlists are bogus references
@@ -3721,7 +3730,6 @@ set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
37213730

37223731
item_width=subrel->attr_widths[var->varattno-subrel->min_attr];
37233732
}
3724-
Assert(te->resno >=rel->min_attr&&te->resno <=rel->max_attr);
37253733
rel->attr_widths[te->resno-rel->min_attr]=item_width;
37263734
}
37273735

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp