diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-03-23 01:49:02 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-03-23 01:49:02 +0000 |
commit | efeffae2457c69802eed7e4c45c1c3c97528a6fe (patch) | |
tree | 8f4a749d855a0c047fb15ee9ea9001553bfcdcbf /src/backend/optimizer/path/indxpath.c | |
parent | 8f5fb5f24e94a2f451ad5a21d51f6a62f6fdd20a (diff) | |
download | postgresql-efeffae2457c69802eed7e4c45c1c3c97528a6fe.tar.gz postgresql-efeffae2457c69802eed7e4c45c1c3c97528a6fe.zip |
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.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 5d16067c756..6d6d4db9f98 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.135 2003/02/08 20:20:54 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.136 2003/03/23 01:49:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2039,7 +2039,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(Node *leftop, Oid expr_op, @@ -2094,10 +2094,13 @@ prefix_quals(Node *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. |