From: Tom Lane Date: Sun, 28 Jan 2007 02:53:42 +0000 (+0000) Subject: Dept of second thoughts: the IQ of estimate_array_length() needs to be X-Git-Tag: REL8_2_2~17 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=e96164dd712c13cda07912feb31c9792ad2e93ca;p=users%2Fhanada%2Fpostgres.git 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. --- diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 5e26ee500c..b65959047c 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.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;