summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/indxpath.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-03-23 01:49:13 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-03-23 01:49:13 +0000
commit2d0cf42cd41a7784a9fa691221a14b978ee631db (patch)
treec9b038ddf04278d8c352f59a4e9d190f1ce0ea67 /src/backend/optimizer/path/indxpath.c
parente8b9aeea416aafdc7472c7c29743b8ede20e7e70 (diff)
Tweak selectivity and related routines to cope with domains. Per report
from Andreas Pflug.
Diffstat (limited to 'src/backend/optimizer/path/indxpath.c')
-rw-r--r--src/backend/optimizer/path/indxpath.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 2dab5e54cdd..87b25d28a43 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.124 2002/11/01 19:33:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.124.2.1 2003/03/23 01:49:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1848,7 +1848,7 @@ expand_indexqual_conditions(List *indexquals)
* Given a fixed prefix that all the "leftop" values must have,
* generate suitable indexqual condition(s). expr_op is the original
* LIKE or regex operator; we use it to deduce the appropriate comparison
- * operators.
+ * operators and operand datatypes.
*/
static List *
prefix_quals(Var *leftop, Oid expr_op,
@@ -1904,10 +1904,13 @@ prefix_quals(Var *leftop, Oid expr_op,
return NIL;
}
- if (prefix_const->consttype != BYTEAOID)
- prefix = DatumGetCString(DirectFunctionCall1(textout, prefix_const->constvalue));
+ /* Prefix constant is text for all except BYTEA_LIKE */
+ if (datatype != BYTEAOID)
+ prefix = DatumGetCString(DirectFunctionCall1(textout,
+ prefix_const->constvalue));
else
- prefix = DatumGetCString(DirectFunctionCall1(byteaout, prefix_const->constvalue));
+ prefix = DatumGetCString(DirectFunctionCall1(byteaout,
+ prefix_const->constvalue));
/*
* If we found an exact-match pattern, generate an "=" indexqual.