index 08f1d361bae8b6fdf4d3b827820deabf2b4e2111..1ede488c13b13f910b0d676f6935c9cfeaf9afc6 100644 (file)
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.209 2009年06月11日 14:48:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.210 2009年07月11日 04:09:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
else
{
- /* For now, punt on whole-row child Vars */
- tuple_width += 32; /* arbitrary */
+ /*
+ * We could be looking at an expression pulled up from a subquery,
+ * or a ROW() representing a whole-row child Var, etc. Do what
+ * we can using the expression type information.
+ */
+ int32 item_width;
+
+ item_width = get_typavgwidth(exprType(node), exprTypmod(node));
+ Assert(item_width > 0);
+ tuple_width += item_width;
}
}
Assert(tuple_width >= 0);