1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-03 22:24:49 +03:00

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.
This commit is contained in:
Tom Lane 2007-01-28 02:53:42 +00:00
parent ff3c2e4e46
commit e96164dd71

View File

@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * 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 int
estimate_array_length(Node *arrayexpr) estimate_array_length(Node *arrayexpr)
{ {
/* look through any binary-compatible relabeling of arrayexpr */
arrayexpr = strip_array_coercion(arrayexpr);
if (arrayexpr && IsA(arrayexpr, Const)) if (arrayexpr && IsA(arrayexpr, Const))
{ {
Datum arraydatum = ((Const *) arrayexpr)->constvalue; Datum arraydatum = ((Const *) arrayexpr)->constvalue;