diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-03 17:45:38 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-03 17:45:38 +0000 |
commit | b255350864ec215b96de604af57fd984a09f4b3a (patch) | |
tree | 82514b0a943c0477fd728eaa620e1b6f8aa403d6 /src/backend/optimizer/path/costsize.c | |
parent | be5a80739b735257a9738f4d12781345da1f4050 (diff) |
Planner failed to be smart about binary-compatible expressions in pathkeys
and hash bucket-size estimation. Issue has been there awhile but is more
critical in 7.4 because it affects varchar columns. Per report from
Greg Stark.
Diffstat (limited to 'src/backend/optimizer/path/costsize.c')
-rw-r--r-- | src/backend/optimizer/path/costsize.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 65eed58c9fb..4b500bc03a5 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -49,7 +49,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.115 2003/10/05 22:44:25 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.115.2.1 2003/12/03 17:45:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1322,6 +1322,10 @@ estimate_hash_bucketsize(Query *root, Var *var, int nbuckets) float4 *numbers; int nnumbers; + /* Ignore any binary-compatible relabeling */ + if (var && IsA(var, RelabelType)) + var = (Var *) ((RelabelType *) var)->arg; + /* * Lookup info about var's relation and attribute; if none available, * return default estimate. |