]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Dept of second thoughts: the IQ of estimate_array_length() needs to be
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Jan 2007 02:53:42 +0000 (02:53 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Jan 2007 02:53:42 +0000 (02:53 +0000)
kept on par with that of scalararraysel(), else estimates that should
track might not.  Hence teach it about binary-compatible cases, too.

src/backend/utils/adt/selfuncs.c

index 5e26ee500cabf12b8766b5f888a34c87d3d84eeb..b65959047c277b5fafff279062f030f18243315a 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.214.2.3 2007/01/28 01:37:45 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.214.2.4 2007/01/28 02:53:42 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1700,6 +1700,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;