From fd791e7b5a1bf53131ad15e68e4d4f8ca795fcb4 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 24 Mar 2008 21:53:04 +0000 Subject: When a relation has been proven empty by constraint exclusion, propagate that knowledge up through any joins it participates in. We were doing that already in some special cases but not in the general case. Also, defend against zero row estimates for the input relations in cost_mergejoin --- this fix may have eliminated the only scenario in which that can happen, but be safe. Per report from Alex Solovey. --- src/include/nodes/relation.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index b106c590e3e..9e9e7afbc84 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.154 2008/01/11 04:02:18 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.155 2008/03/24 21:53:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -693,6 +693,8 @@ typedef struct TidPath * * Note: it is possible for "subpaths" to contain only one, or even no, * elements. These cases are optimized during create_append_plan. + * In particular, an AppendPath with no subpaths is a "dummy" path that + * is created to represent the case that a relation is provably empty. */ typedef struct AppendPath { @@ -700,6 +702,9 @@ typedef struct AppendPath List *subpaths; /* list of component Paths */ } AppendPath; +#define IS_DUMMY_PATH(p) \ + (IsA((p), AppendPath) && ((AppendPath *) (p))->subpaths == NIL) + /* * ResultPath represents use of a Result plan node to compute a variable-free * targetlist with no underlying tables (a "SELECT expressions" query). -- cgit v1.2.3