Commit 8ae9ad1c authored by Tom Lane's avatar Tom Lane

Reimplement LIKE/ESCAPE as operators so that indexscan optimization

can still work, per recent discussion on pghackers.  Correct some bugs
in ILIKE implementation.
parent 148f905f
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.95 2000/09/12 21:06:53 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.96 2000/09/15 18:45:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1755,6 +1755,20 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
pfree(patt);
break;
case OID_TEXT_ICLIKE_OP:
case OID_BPCHAR_ICLIKE_OP:
case OID_VARCHAR_ICLIKE_OP:
case OID_NAME_ICLIKE_OP:
/* the right-hand const is type text for all of these */
patt = DatumGetCString(DirectFunctionCall1(textout,
constvalue));
isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Like_IC,
&prefix, &rest) != Pattern_Prefix_None;
if (prefix)
pfree(prefix);
pfree(patt);
break;
case OID_TEXT_REGEXEQ_OP:
case OID_BPCHAR_REGEXEQ_OP:
case OID_VARCHAR_REGEXEQ_OP:
......@@ -1797,6 +1811,7 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
switch (expr_op)
{
case OID_TEXT_LIKE_OP:
case OID_TEXT_ICLIKE_OP:
case OID_TEXT_REGEXEQ_OP:
case OID_TEXT_ICREGEXEQ_OP:
if (!op_class(find_operator(">=", TEXTOID), opclass, relam) ||
......@@ -1805,6 +1820,7 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
break;
case OID_BPCHAR_LIKE_OP:
case OID_BPCHAR_ICLIKE_OP:
case OID_BPCHAR_REGEXEQ_OP:
case OID_BPCHAR_ICREGEXEQ_OP:
if (!op_class(find_operator(">=", BPCHAROID), opclass, relam) ||
......@@ -1813,6 +1829,7 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
break;
case OID_VARCHAR_LIKE_OP:
case OID_VARCHAR_ICLIKE_OP:
case OID_VARCHAR_REGEXEQ_OP:
case OID_VARCHAR_ICREGEXEQ_OP:
if (!op_class(find_operator(">=", VARCHAROID), opclass, relam) ||
......@@ -1821,6 +1838,7 @@ match_special_index_operator(Expr *clause, Oid opclass, Oid relam,
break;
case OID_NAME_LIKE_OP:
case OID_NAME_ICLIKE_OP:
case OID_NAME_REGEXEQ_OP:
case OID_NAME_ICREGEXEQ_OP:
if (!op_class(find_operator(">=", NAMEOID), opclass, relam) ||
......@@ -1887,6 +1905,24 @@ expand_indexqual_conditions(List *indexquals)
pfree(patt);
break;
case OID_TEXT_ICLIKE_OP:
case OID_BPCHAR_ICLIKE_OP:
case OID_VARCHAR_ICLIKE_OP:
case OID_NAME_ICLIKE_OP:
/* the right-hand const is type text for all of these */
constvalue = ((Const *) rightop)->constvalue;
patt = DatumGetCString(DirectFunctionCall1(textout,
constvalue));
pstatus = pattern_fixed_prefix(patt, Pattern_Type_Like_IC,
&prefix, &rest);
resultquals = nconc(resultquals,
prefix_quals(leftop, expr_op,
prefix, pstatus));
if (prefix)
pfree(prefix);
pfree(patt);
break;
case OID_TEXT_REGEXEQ_OP:
case OID_BPCHAR_REGEXEQ_OP:
case OID_VARCHAR_REGEXEQ_OP:
......@@ -1955,24 +1991,28 @@ prefix_quals(Var *leftop, Oid expr_op,
switch (expr_op)
{
case OID_TEXT_LIKE_OP:
case OID_TEXT_ICLIKE_OP:
case OID_TEXT_REGEXEQ_OP:
case OID_TEXT_ICREGEXEQ_OP:
datatype = TEXTOID;
break;
case OID_BPCHAR_LIKE_OP:
case OID_BPCHAR_ICLIKE_OP:
case OID_BPCHAR_REGEXEQ_OP:
case OID_BPCHAR_ICREGEXEQ_OP:
datatype = BPCHAROID;
break;
case OID_VARCHAR_LIKE_OP:
case OID_VARCHAR_ICLIKE_OP:
case OID_VARCHAR_REGEXEQ_OP:
case OID_VARCHAR_ICREGEXEQ_OP:
datatype = VARCHAROID;
break;
case OID_NAME_LIKE_OP:
case OID_NAME_ICLIKE_OP:
case OID_NAME_REGEXEQ_OP:
case OID_NAME_ICREGEXEQ_OP:
datatype = NAMEOID;
......
......@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.189 2000/09/12 21:07:01 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.190 2000/09/15 18:45:30 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
......@@ -365,6 +365,7 @@ static void doNegateFloat(Value *v);
%right '='
%nonassoc '<' '>'
%nonassoc LIKE ILIKE
%nonassoc ESCAPE
%nonassoc OVERLAPS
%nonassoc BETWEEN
%nonassoc IN
......@@ -382,7 +383,6 @@ static void doNegateFloat(Value *v);
%left '.'
%left '[' ']'
%left TYPECAST
%left ESCAPE
%%
/*
......@@ -4522,76 +4522,48 @@ a_expr: c_expr
{ $$ = makeA_Expr(NOT, NULL, NULL, $2); }
| a_expr LIKE a_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "like";
n->args = makeList($1, $3, -1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
}
{ $$ = makeA_Expr(OP, "~~", $1, $3); }
| a_expr LIKE a_expr ESCAPE a_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "like";
n->args = makeList($1, $3, $5, -1);
n->funcname = "like_escape";
n->args = makeList($3, $5, -1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
$$ = makeA_Expr(OP, "~~", $1, (Node *) n);
}
| a_expr NOT LIKE a_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "notlike";
n->args = makeList($1, $4, -1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
}
{ $$ = makeA_Expr(OP, "!~~", $1, $4); }
| a_expr NOT LIKE a_expr ESCAPE a_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "notlike";
n->args = makeList($1, $4, $6, -1);
n->funcname = "like_escape";
n->args = makeList($4, $6, -1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
$$ = makeA_Expr(OP, "!~~", $1, (Node *) n);
}
| a_expr ILIKE a_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "ilike";
n->args = makeList($1, $3, -1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
}
{ $$ = makeA_Expr(OP, "~~*", $1, $3); }
| a_expr ILIKE a_expr ESCAPE a_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "ilike";
n->args = makeList($1, $3, $5, -1);
n->funcname = "like_escape";
n->args = makeList($3, $5, -1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
$$ = makeA_Expr(OP, "~~*", $1, (Node *) n);
}
| a_expr NOT ILIKE a_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "inotlike";
n->args = makeList($1, $4, -1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
}
{ $$ = makeA_Expr(OP, "!~~*", $1, $4); }
| a_expr NOT ILIKE a_expr ESCAPE a_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "inotlike";
n->args = makeList($1, $4, $6, -1);
n->funcname = "like_escape";
n->args = makeList($4, $6, -1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
$$ = makeA_Expr(OP, "!~~*", $1, (Node *) n);
}
| a_expr ISNULL
......
This diff is collapsed.
......@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.78 2000/08/03 16:34:22 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.79 2000/09/15 18:45:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -570,6 +570,15 @@ likesel(PG_FUNCTION_ARGS)
return patternsel(fcinfo, Pattern_Type_Like);
}
/*
* iclikesel - Selectivity of ILIKE pattern match.
*/
Datum
iclikesel(PG_FUNCTION_ARGS)
{
return patternsel(fcinfo, Pattern_Type_Like_IC);
}
/*
* regexnesel - Selectivity of regular-expression pattern non-match.
*/
......@@ -609,6 +618,19 @@ nlikesel(PG_FUNCTION_ARGS)
PG_RETURN_FLOAT8(result);
}
/*
* icnlikesel - Selectivity of ILIKE pattern non-match.
*/
Datum
icnlikesel(PG_FUNCTION_ARGS)
{
float8 result;
result = DatumGetFloat8(patternsel(fcinfo, Pattern_Type_Like_IC));
result = 1.0 - result;
PG_RETURN_FLOAT8(result);
}
/*
* eqjoinsel - Join selectivity of "="
*/
......@@ -723,6 +745,15 @@ likejoinsel(PG_FUNCTION_ARGS)
PG_RETURN_FLOAT8(DEFAULT_MATCH_SEL);
}
/*
* iclikejoinsel - Join selectivity of ILIKE pattern match.
*/
Datum
iclikejoinsel(PG_FUNCTION_ARGS)
{
PG_RETURN_FLOAT8(DEFAULT_MATCH_SEL);
}
/*
* regexnejoinsel - Join selectivity of regex non-match.
*/
......@@ -762,6 +793,19 @@ nlikejoinsel(PG_FUNCTION_ARGS)
PG_RETURN_FLOAT8(result);
}
/*
* icnlikejoinsel - Join selectivity of ILIKE pattern non-match.
*/
Datum
icnlikejoinsel(PG_FUNCTION_ARGS)
{
float8 result;
result = DatumGetFloat8(iclikejoinsel(fcinfo));
result = 1.0 - result;
PG_RETURN_FLOAT8(result);
}
/*
* convert_to_scalar
......@@ -1337,7 +1381,8 @@ getattstatistics(Oid relid,
*/
static Pattern_Prefix_Status
like_fixed_prefix(char *patt, char **prefix, char **rest)
like_fixed_prefix(char *patt, bool case_insensitive,
char **prefix, char **rest)
{
char *match;
int pos,
......@@ -1359,7 +1404,12 @@ like_fixed_prefix(char *patt, char **prefix, char **rest)
if (patt[pos] == '\0')
break;
}
/*
* XXX I suspect isalpha() is not an adequately locale-sensitive
* test for characters that can vary under case folding?
*/
if (case_insensitive && isalpha((int) patt[pos]))
break;
/*
* NOTE: this code used to think that %% meant a literal %, but
* textlike() itself does not think that, and the SQL92 spec
......@@ -1497,7 +1547,10 @@ pattern_fixed_prefix(char *patt, Pattern_Type ptype,
switch (ptype)
{
case Pattern_Type_Like:
result = like_fixed_prefix(patt, prefix, rest);
result = like_fixed_prefix(patt, false, prefix, rest);
break;
case Pattern_Type_Like_IC:
result = like_fixed_prefix(patt, true, prefix, rest);
break;
case Pattern_Type_Regex:
result = regex_fixed_prefix(patt, false, prefix, rest);
......@@ -1625,7 +1678,7 @@ prefix_selectivity(char *prefix,
#define PARTIAL_WILDCARD_SEL 2.0
static Selectivity
like_selectivity(char *patt)
like_selectivity(char *patt, bool case_insensitive)
{
Selectivity sel = 1.0;
int pos;
......@@ -1780,7 +1833,10 @@ pattern_selectivity(char *patt, Pattern_Type ptype)
switch (ptype)
{
case Pattern_Type_Like:
result = like_selectivity(patt);
result = like_selectivity(patt, false);
break;
case Pattern_Type_Like_IC:
result = like_selectivity(patt, true);
break;
case Pattern_Type_Regex:
result = regex_selectivity(patt, false);
......
......@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catversion.h,v 1.45 2000/09/12 21:07:06 tgl Exp $
* $Id: catversion.h,v 1.46 2000/09/15 18:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200009121
#define CATALOG_VERSION_NO 200009151
#endif
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_operator.h,v 1.81 2000/08/21 04:48:51 tgl Exp $
* $Id: pg_operator.h,v 1.82 2000/09/15 18:45:27 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
......@@ -537,7 +537,7 @@ DATA(insert OID = 1213 ( "~~" PGUID 0 b t f 1043 25 16 0 1214 0 0 textlike
#define OID_VARCHAR_LIKE_OP 1213
DATA(insert OID = 1214 ( "!~~" PGUID 0 b t f 1043 25 16 0 1213 0 0 textnlike nlikesel nlikejoinsel ));
/* case-insensitive LIKE hacks */
/* case-insensitive regex hacks */
DATA(insert OID = 1226 ( "~*" PGUID 0 b t f 19 25 16 0 1227 0 0 nameicregexeq icregexeqsel icregexeqjoinsel ));
#define OID_NAME_ICREGEXEQ_OP 1226
DATA(insert OID = 1227 ( "!~*" PGUID 0 b t f 19 25 16 0 1226 0 0 nameicregexne icregexnesel icregexnejoinsel ));
......@@ -690,6 +690,20 @@ DATA(insert OID = 827 ( "<<=" PGUID 0 b t f 650 650 16 1004 0 0 0 network_
DATA(insert OID = 828 ( ">>" PGUID 0 b t f 650 650 16 826 0 0 0 network_sup - - ));
DATA(insert OID = 1004 ( ">>=" PGUID 0 b t f 650 650 16 827 0 0 0 network_supeq - - ));
/* case-insensitive LIKE hacks */
DATA(insert OID = 1625 ( "~~*" PGUID 0 b t f 19 25 16 0 1626 0 0 nameiclike iclikesel iclikejoinsel ));
#define OID_NAME_ICLIKE_OP 1625
DATA(insert OID = 1626 ( "!~~*" PGUID 0 b t f 19 25 16 0 1625 0 0 nameicnlike icnlikesel icnlikejoinsel ));
DATA(insert OID = 1627 ( "~~*" PGUID 0 b t f 25 25 16 0 1628 0 0 texticlike iclikesel iclikejoinsel ));
#define OID_TEXT_ICLIKE_OP 1627
DATA(insert OID = 1628 ( "!~~*" PGUID 0 b t f 25 25 16 0 1627 0 0 texticnlike icnlikesel icnlikejoinsel ));
DATA(insert OID = 1629 ( "~~*" PGUID 0 b t f 1042 25 16 0 1630 0 0 texticlike iclikesel iclikejoinsel ));
#define OID_BPCHAR_ICLIKE_OP 1629
DATA(insert OID = 1630 ( "!~~*" PGUID 0 b t f 1042 25 16 0 1629 0 0 texticnlike icnlikesel icnlikejoinsel ));
DATA(insert OID = 1631 ( "~~*" PGUID 0 b t f 1043 25 16 0 1632 0 0 texticlike iclikesel iclikejoinsel ));
#define OID_VARCHAR_ICLIKE_OP 1631
DATA(insert OID = 1632 ( "!~~*" PGUID 0 b t f 1043 25 16 0 1631 0 0 texticnlike icnlikesel icnlikejoinsel ));
/* NUMERIC type - OID's 1700-1799 */
DATA(insert OID = 1751 ( "-" PGUID 0 l t f 0 1700 1700 0 0 0 0 numeric_uminus - - ));
DATA(insert OID = 1752 ( "=" PGUID 0 b t f 1700 1700 16 1752 1753 1754 1754 numeric_eq eqsel eqjoinsel ));
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.165 2000/09/05 20:25:13 wieck Exp $
* $Id: pg_proc.h,v 1.166 2000/09/15 18:45:27 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
......@@ -2039,30 +2039,16 @@ DATA(insert OID = 1623 ( varchar PGUID 12 f t t t 1 f 1043 "20" 100 0 0 100
DESCR("convert int8 to varchar");
DATA(insert OID = 1624 ( mul_d_interval PGUID 12 f t t t 2 f 1186 "701 1186" 100 0 0 100 mul_d_interval - ));
DATA(insert OID = 1625 ( like PGUID 12 f t t t 3 f 16 "19 25 25" 100 0 0 100 namelike_escape - ));
DESCR("matches LIKE expression");
DATA(insert OID = 1626 ( notlike PGUID 12 f t t t 3 f 16 "19 25 25" 100 0 0 100 namenlike_escape - ));
DESCR("does not match LIKE expression");
DATA(insert OID = 1627 ( ilike PGUID 12 f t t t 3 f 16 "19 25 25" 100 0 0 100 inamelike_escape - ));
DESCR("matches case-insensitive LIKE expression");
DATA(insert OID = 1628 ( inotlike PGUID 12 f t t t 3 f 16 "19 25 25" 100 0 0 100 inamenlike_escape - ));
DESCR("does not match case-insensitive LIKE expression");
DATA(insert OID = 1629 ( like PGUID 12 f t t t 3 f 16 "25 25 25" 100 0 0 100 textlike_escape - ));
DESCR("matches LIKE expression");
DATA(insert OID = 1630 ( notlike PGUID 12 f t t t 3 f 16 "25 25 25" 100 0 0 100 textnlike_escape - ));
DESCR("does not match LIKE expression");
DATA(insert OID = 1631 ( ilike PGUID 12 f t t t 3 f 16 "25 25 25" 100 0 0 100 itextlike_escape - ));
DESCR("matches case-insensitive LIKE expression");
DATA(insert OID = 1632 ( inotlike PGUID 12 f t t t 3 f 16 "25 25 25" 100 0 0 100 itextnlike_escape - ));
DESCR("does not match case-insensitive LIKE expression");
DATA(insert OID = 1633 ( ilike PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100 itextlike - ));
DESCR("matches case-insensitive LIKE expression");
DATA(insert OID = 1634 ( inotlike PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100 itextnlike - ));
DESCR("does not match case-insensitive LIKE expression");
DATA(insert OID = 1635 ( ilike PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100 inamelike - ));
DESCR("matches case-insensitive LIKE expression");
DATA(insert OID = 1636 ( inotlike PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100 inamenlike - ));
DESCR("does not match case-insensitive LIKE expression");
DATA(insert OID = 1633 ( texticlike PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100 texticlike - ));
DESCR("matches LIKE expression, case-insensitive");
DATA(insert OID = 1634 ( texticnlike PGUID 12 f t t t 2 f 16 "25 25" 100 0 0 100 texticnlike - ));
DESCR("does not match LIKE expression, case-insensitive");
DATA(insert OID = 1635 ( nameiclike PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100 nameiclike - ));
DESCR("matches LIKE expression, case-insensitive");
DATA(insert OID = 1636 ( nameicnlike PGUID 12 f t t t 2 f 16 "19 25" 100 0 0 100 nameicnlike - ));
DESCR("does not match LIKE expression, case-insensitive");
DATA(insert OID = 1637 ( like_escape PGUID 12 f t t t 2 f 25 "25 25" 100 0 0 100 like_escape - ));
DESCR("convert match pattern to use backslash escapes");
DATA(insert OID = 1689 ( update_pg_pwd PGUID 12 f t f t 0 f 0 "" 100 0 0 100 update_pg_pwd - ));
DESCR("update pg_pwd file");
......@@ -2420,6 +2406,14 @@ DATA(insert OID = 1799 ( oidout PGUID 12 f t t t 1 f 23 "0" 100 0 0 100 oi
DESCR("(internal)");
/* Selectivity estimators for LIKE and related operators */
DATA(insert OID = 1814 ( iclikesel PGUID 12 f t f t 5 f 701 "26 26 21 0 23" 100 0 0 100 iclikesel - ));
DESCR("restriction selectivity of ILIKE");
DATA(insert OID = 1815 ( icnlikesel PGUID 12 f t f t 5 f 701 "26 26 21 0 23" 100 0 0 100 icnlikesel - ));
DESCR("restriction selectivity of NOT ILIKE");
DATA(insert OID = 1816 ( iclikejoinsel PGUID 12 f t f t 5 f 701 "26 26 21 26 21" 100 0 0 100 iclikejoinsel - ));
DESCR("join selectivity of ILIKE");
DATA(insert OID = 1817 ( icnlikejoinsel PGUID 12 f t f t 5 f 701 "26 26 21 26 21" 100 0 0 100 icnlikejoinsel - ));
DESCR("join selectivity of NOT ILIKE");
DATA(insert OID = 1818 ( regexeqsel PGUID 12 f t f t 5 f 701 "26 26 21 0 23" 100 0 0 100 regexeqsel - ));
DESCR("restriction selectivity of regex match");
DATA(insert OID = 1819 ( likesel PGUID 12 f t f t 5 f 701 "26 26 21 0 23" 100 0 0 100 likesel - ));
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.136 2000/09/05 20:25:14 wieck Exp $
* $Id: builtins.h,v 1.137 2000/09/15 18:45:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -320,9 +320,11 @@ extern Datum scalargtsel(PG_FUNCTION_ARGS);
extern Datum regexeqsel(PG_FUNCTION_ARGS);
extern Datum icregexeqsel(PG_FUNCTION_ARGS);
extern Datum likesel(PG_FUNCTION_ARGS);
extern Datum iclikesel(PG_FUNCTION_ARGS);
extern Datum regexnesel(PG_FUNCTION_ARGS);
extern Datum icregexnesel(PG_FUNCTION_ARGS);
extern Datum nlikesel(PG_FUNCTION_ARGS);
extern Datum icnlikesel(PG_FUNCTION_ARGS);
extern Datum eqjoinsel(PG_FUNCTION_ARGS);
extern Datum neqjoinsel(PG_FUNCTION_ARGS);
......@@ -331,9 +333,11 @@ extern Datum scalargtjoinsel(PG_FUNCTION_ARGS);
extern Datum regexeqjoinsel(PG_FUNCTION_ARGS);
extern Datum icregexeqjoinsel(PG_FUNCTION_ARGS);
extern Datum likejoinsel(PG_FUNCTION_ARGS);
extern Datum iclikejoinsel(PG_FUNCTION_ARGS);
extern Datum regexnejoinsel(PG_FUNCTION_ARGS);
extern Datum icregexnejoinsel(PG_FUNCTION_ARGS);
extern Datum nlikejoinsel(PG_FUNCTION_ARGS);
extern Datum icnlikejoinsel(PG_FUNCTION_ARGS);
extern Datum btcostestimate(PG_FUNCTION_ARGS);
extern Datum rtcostestimate(PG_FUNCTION_ARGS);
......@@ -343,7 +347,8 @@ extern Datum gistcostestimate(PG_FUNCTION_ARGS);
/* selfuncs.c supporting routines that are also used by optimizer code */
typedef enum
{
Pattern_Type_Like, Pattern_Type_Regex, Pattern_Type_Regex_IC
Pattern_Type_Like, Pattern_Type_Like_IC,
Pattern_Type_Regex, Pattern_Type_Regex_IC
} Pattern_Type;
typedef enum
......@@ -432,20 +437,13 @@ extern Datum pgsql_version(PG_FUNCTION_ARGS);
/* like.c */
extern Datum namelike(PG_FUNCTION_ARGS);
extern Datum namenlike(PG_FUNCTION_ARGS);
extern Datum namelike_escape(PG_FUNCTION_ARGS);
extern Datum namenlike_escape(PG_FUNCTION_ARGS);
extern Datum inamelike(PG_FUNCTION_ARGS);
extern Datum inamenlike(PG_FUNCTION_ARGS);
extern Datum inamelike_escape(PG_FUNCTION_ARGS);
extern Datum inamenlike_escape(PG_FUNCTION_ARGS);
extern Datum nameiclike(PG_FUNCTION_ARGS);
extern Datum nameicnlike(PG_FUNCTION_ARGS);
extern Datum textlike(PG_FUNCTION_ARGS);
extern Datum textnlike(PG_FUNCTION_ARGS);
extern Datum textlike_escape(PG_FUNCTION_ARGS);
extern Datum textnlike_escape(PG_FUNCTION_ARGS);
extern Datum itextlike(PG_FUNCTION_ARGS);
extern Datum itextnlike(PG_FUNCTION_ARGS);
extern Datum itextlike_escape(PG_FUNCTION_ARGS);
extern Datum itextnlike_escape(PG_FUNCTION_ARGS);
extern Datum texticlike(PG_FUNCTION_ARGS);
extern Datum texticnlike(PG_FUNCTION_ARGS);
extern Datum like_escape(PG_FUNCTION_ARGS);
/* oracle_compat.c */
extern Datum lower(PG_FUNCTION_ARGS);
......
......@@ -443,13 +443,13 @@ SELECT 'hawkeye' NOT ILIKE 'H%' AS "false";
SELECT 'hawkeye' ILIKE 'H%Eye' AS "true";
true
------
f
t
(1 row)
SELECT 'hawkeye' NOT ILIKE 'H%Eye' AS "false";
false
-------
t
f
(1 row)
SELECT 'Hawkeye' ILIKE 'h%' AS "true";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment