summaryrefslogtreecommitdiff
path: root/src/include/nodes/relation.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-03-24 21:53:04 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-03-24 21:53:04 +0000
commitfd791e7b5a1bf53131ad15e68e4d4f8ca795fcb4 (patch)
tree4fbde4ad7311749be170edf100dac55fa464c7f3 /src/include/nodes/relation.h
parent2a346725bafbc6c7a5dd1771c6004703545a935c (diff)
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.
Diffstat (limited to 'src/include/nodes/relation.h')
-rw-r--r--src/include/nodes/relation.h7
1 files changed, 6 insertions, 1 deletions
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).