aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-01-28 02:53:34 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-01-28 02:53:34 +0000
commita053437d9ee71ba99a648a76652401dcc590cf13 (patch)
tree2aa4d4a02dc453435889880ad06eb36d3f30de2d
parentc2c0b318d8966a2fa94690db3d5876a659adace8 (diff)
downloadpostgresql-a053437d9ee71ba99a648a76652401dcc590cf13.tar.gz
postgresql-a053437d9ee71ba99a648a76652401dcc590cf13.zip
Dept of second thoughts: the IQ of estimate_array_length() needs to be
kept on par with that of scalararraysel(), else estimates that should track might not. Hence teach it about binary-compatible cases, too.
-rw-r--r--src/backend/utils/adt/selfuncs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 7bf135c2b24..0780e52a896 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.222 2007/01/28 01:37:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.223 2007/01/28 02:53:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1698,6 +1698,9 @@ scalararraysel(PlannerInfo *root,
int
estimate_array_length(Node *arrayexpr)
{
+ /* look through any binary-compatible relabeling of arrayexpr */
+ arrayexpr = strip_array_coercion(arrayexpr);
+
if (arrayexpr && IsA(arrayexpr, Const))
{
Datum arraydatum = ((Const *) arrayexpr)->constvalue;