diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-01-28 02:53:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-01-28 02:53:42 +0000 |
commit | e96164dd712c13cda07912feb31c9792ad2e93ca (patch) | |
tree | 2a6bd2b32697ebb96fe354ce8c098077f6e7ba7e | |
parent | ff3c2e4e46abd998ee4af1fb730642518e24b624 (diff) | |
download | postgresql-e96164dd712c13cda07912feb31c9792ad2e93ca.tar.gz |
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.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; |