postgresql/src/backend
Tom Lane 358eaa01bf Make entirely-dummy appendrels get marked as such in set_append_rel_size.
The planner generally expects that the estimated rowcount of any relation
is at least one row, *unless* it has been proven empty by constraint
exclusion or similar mechanisms, which is marked by installing a dummy path
as the rel's cheapest path (cf. IS_DUMMY_REL).  When I split up
allpaths.c's processing of base rels into separate set_base_rel_sizes and
set_base_rel_pathlists steps, the intention was that dummy rels would get
marked as such during the "set size" step; this is what justifies an Assert
in indxpath.c's get_loop_count that other relations should either be dummy
or have positive rowcount.  Unfortunately I didn't get that quite right
for append relations: if all the child rels have been proven empty then
set_append_rel_size would come up with a rowcount of zero, which is
correct, but it didn't then do set_dummy_rel_pathlist.  (We would have
ended up with the right state after set_append_rel_pathlist, but that's
too late, if we generate indexpaths for some other rel first.)

In addition to fixing the actual bug, I installed an Assert enforcing this
convention in set_rel_size; that then allows simplification of a couple
of now-redundant tests for zero rowcount in set_append_rel_size.

Also, to cover the possibility that third-party FDWs have been careless
about not returning a zero rowcount estimate, apply clamp_row_est to
whatever an FDW comes up with as the rows estimate.

Per report from Andreas Seltenreich.  Back-patch to 9.2.  Earlier branches
did not have the separation between set_base_rel_sizes and
set_base_rel_pathlists steps, so there was no intermediate state where an
appendrel would have had inconsistent rowcount and pathlist.  It's possible
that adding the Assert to set_rel_size would be a good idea in older
branches too; but since they're not under development any more, it's likely
not worth the trouble.
2015-07-26 16:19:08 -04:00
..
access Dodge portability issue (apparent compiler bug) in new tablesample code. 2015-07-25 19:42:32 -04:00
bootstrap pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
commands Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
executor Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Use appendStringInfoString/Char et al where appropriate. 2015-07-02 12:36:03 +03:00
libpq Call getsockopt() on the correct socket. 2015-07-06 16:36:48 +03:00
main Revoke support for strxfrm() that write past the specified array length. 2015-07-08 20:44:21 -04:00
nodes Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
optimizer Make entirely-dummy appendrels get marked as such in set_append_rel_size. 2015-07-26 16:19:08 -04:00
parser Fix flattening of nested grouping sets. 2015-07-26 16:50:29 +02:00
po Translation updates 2015-06-28 23:56:55 -04:00
port Make WaitLatchOrSocket's timeout detection more robust. 2015-07-18 11:47:13 -04:00
postmaster Fix postmaster's handling of a startup-process crash. 2015-07-09 13:22:22 -04:00
regex Replace a bunch more uses of strncpy() with safer coding. 2015-01-24 13:05:42 -05:00
replication Fix logical decoding bug leading to inefficient reopening of files. 2015-07-07 13:12:46 +02:00
rewrite Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
snowball Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
storage Fix a couple of bugs with wal_log_hints. 2015-06-26 12:38:24 +03:00
tcop Add ALTER OPERATOR command, for changing selectivity estimator functions. 2015-07-14 18:17:55 +03:00
tsearch pgindent run for 9.5 2015-05-23 21:35:49 -04:00
utils Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile AIX: Link the postgres executable with -Wl,-brtllib. 2015-07-15 21:00:26 -04:00
nls.mk Translation updates 2015-02-01 23:23:40 -05:00