aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/src/sgml/indices.sgml19
-rw-r--r--src/backend/access/nbtree/nbtcompare.c11
-rw-r--r--src/backend/optimizer/path/indxpath.c8
-rw-r--r--src/backend/utils/adt/name.c61
-rw-r--r--src/backend/utils/adt/varchar.c111
-rw-r--r--src/backend/utils/adt/varlena.c57
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/pg_amop.h22
-rw-r--r--src/include/catalog/pg_amproc.h8
-rw-r--r--src/include/catalog/pg_opclass.h4
-rw-r--r--src/include/catalog/pg_operator.h13
-rw-r--r--src/include/catalog/pg_opfamily.h5
-rw-r--r--src/include/catalog/pg_proc.h25
-rw-r--r--src/include/utils/builtins.h18
-rw-r--r--src/test/regress/expected/opr_sanity.out15
15 files changed, 168 insertions, 213 deletions
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 6fcb6968ffc..3de05419226 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.72 2007/11/13 23:36:26 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.73 2008/05/27 00:13:08 tgl Exp $ -->
<chapter id="indexes">
<title id="indexes-title">Indexes</title>
@@ -906,11 +906,10 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
<listitem>
<para>
The operator classes <literal>text_pattern_ops</literal>,
- <literal>varchar_pattern_ops</literal>,
- <literal>bpchar_pattern_ops</literal>, and
- <literal>name_pattern_ops</literal> support B-tree indexes on
- the types <type>text</type>, <type>varchar</type>,
- <type>char</type>, and <type>name</type>, respectively. The
+ <literal>varchar_pattern_ops</literal>, and
+ <literal>bpchar_pattern_ops</literal> support B-tree indexes on
+ the types <type>text</type>, <type>varchar</type>, and
+ <type>char</type> respectively. The
difference from the default operator classes is that the values
are compared strictly character by character rather than
according to the locale-specific collation rules. This makes
@@ -923,10 +922,12 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
CREATE INDEX test_index ON test_table (col varchar_pattern_ops);
</programlisting>
Note that you should also create an index with the default operator
- class if you want queries involving ordinary comparisons to use an
- index. Such queries cannot use the
+ class if you want queries involving ordinary <literal>&lt;</>,
+ <literal>&lt;=</>, <literal>&gt;</>, or <literal>&gt;=</> comparisons
+ to use an index. Such queries cannot use the
<literal><replaceable>xxx</replaceable>_pattern_ops</literal>
- operator classes. It is allowed to create multiple
+ operator classes. (Ordinary equality comparisons can use these
+ operator classes, however.) It is allowed to create multiple
indexes on the same column with different operator classes.
If you do use the C locale, you do not need the
<literal><replaceable>xxx</replaceable>_pattern_ops</literal>
diff --git a/src/backend/access/nbtree/nbtcompare.c b/src/backend/access/nbtree/nbtcompare.c
index 428d3927c2c..697365e6c26 100644
--- a/src/backend/access/nbtree/nbtcompare.c
+++ b/src/backend/access/nbtree/nbtcompare.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.55 2008/01/01 19:45:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.56 2008/05/27 00:13:08 tgl Exp $
*
* NOTES
*
@@ -237,12 +237,3 @@ btnamecmp(PG_FUNCTION_ARGS)
PG_RETURN_INT32(strncmp(NameStr(*a), NameStr(*b), NAMEDATALEN));
}
-
-Datum
-btname_pattern_cmp(PG_FUNCTION_ARGS)
-{
- Name a = PG_GETARG_NAME(0);
- Name b = PG_GETARG_NAME(1);
-
- PG_RETURN_INT32(memcmp(NameStr(*a), NameStr(*b), NAMEDATALEN));
-}
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 4fc7c536548..e0bd5480083 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.230 2008/05/16 16:31:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.231 2008/05/27 00:13:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2178,9 +2178,8 @@ match_special_index_operator(Expr *clause, Oid opfamily,
case OID_NAME_ICLIKE_OP:
case OID_NAME_REGEXEQ_OP:
case OID_NAME_ICREGEXEQ_OP:
- isIndexable =
- (opfamily == NAME_PATTERN_BTREE_FAM_OID) ||
- (opfamily == NAME_BTREE_FAM_OID && lc_collate_is_c());
+ /* name uses locale-insensitive sorting */
+ isIndexable = (opfamily == NAME_BTREE_FAM_OID);
break;
case OID_BYTEA_LIKE_OP:
@@ -2700,7 +2699,6 @@ prefix_quals(Node *leftop, Oid opfamily,
break;
case NAME_BTREE_FAM_OID:
- case NAME_PATTERN_BTREE_FAM_OID:
datatype = NAMEOID;
break;
diff --git a/src/backend/utils/adt/name.c b/src/backend/utils/adt/name.c
index 324736ea63e..96f398e5bb2 100644
--- a/src/backend/utils/adt/name.c
+++ b/src/backend/utils/adt/name.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/name.c,v 1.61 2008/01/01 19:45:52 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/name.c,v 1.62 2008/05/27 00:13:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -181,65 +181,6 @@ namege(PG_FUNCTION_ARGS)
}
-/*
- * comparison routines for LIKE indexing support
- */
-
-Datum
-name_pattern_eq(PG_FUNCTION_ARGS)
-{
- Name arg1 = PG_GETARG_NAME(0);
- Name arg2 = PG_GETARG_NAME(1);
-
- PG_RETURN_BOOL(memcmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) == 0);
-}
-
-Datum
-name_pattern_ne(PG_FUNCTION_ARGS)
-{
- Name arg1 = PG_GETARG_NAME(0);
- Name arg2 = PG_GETARG_NAME(1);
-
- PG_RETURN_BOOL(memcmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) != 0);
-}
-
-Datum
-name_pattern_lt(PG_FUNCTION_ARGS)
-{
- Name arg1 = PG_GETARG_NAME(0);
- Name arg2 = PG_GETARG_NAME(1);
-
- PG_RETURN_BOOL(memcmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) < 0);
-}
-
-Datum
-name_pattern_le(PG_FUNCTION_ARGS)
-{
- Name arg1 = PG_GETARG_NAME(0);
- Name arg2 = PG_GETARG_NAME(1);
-
- PG_RETURN_BOOL(memcmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) <= 0);
-}
-
-Datum
-name_pattern_gt(PG_FUNCTION_ARGS)
-{
- Name arg1 = PG_GETARG_NAME(0);
- Name arg2 = PG_GETARG_NAME(1);
-
- PG_RETURN_BOOL(memcmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) > 0);
-}
-
-Datum
-name_pattern_ge(PG_FUNCTION_ARGS)
-{
- Name arg1 = PG_GETARG_NAME(0);
- Name arg2 = PG_GETARG_NAME(1);
-
- PG_RETURN_BOOL(memcmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) >= 0);
-}
-
-
/* (see char.c for comparison/operation routines) */
int
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c
index ad48f564c5b..8192a87cfe8 100644
--- a/src/backend/utils/adt/varchar.c
+++ b/src/backend/utils/adt/varchar.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/varchar.c,v 1.128 2008/05/04 16:42:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/varchar.c,v 1.129 2008/05/27 00:13:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -886,3 +886,112 @@ hashbpchar(PG_FUNCTION_ARGS)
return result;
}
+
+
+/*
+ * The following operators support character-by-character comparison
+ * of bpchar datums, to allow building indexes suitable for LIKE clauses.
+ * Note that the regular bpchareq/bpcharne comparison operators are assumed
+ * to be compatible with these!
+ */
+
+static int
+internal_bpchar_pattern_compare(BpChar *arg1, BpChar *arg2)
+{
+ int result;
+ int len1,
+ len2;
+
+ len1 = bcTruelen(arg1);
+ len2 = bcTruelen(arg2);
+
+ result = strncmp(VARDATA_ANY(arg1), VARDATA_ANY(arg2), Min(len1, len2));
+ if (result != 0)
+ return result;
+ else if (len1 < len2)
+ return -1;
+ else if (len1 > len2)
+ return 1;
+ else
+ return 0;
+}
+
+
+Datum
+bpchar_pattern_lt(PG_FUNCTION_ARGS)
+{
+ BpChar *arg1 = PG_GETARG_BPCHAR_PP(0);
+ BpChar *arg2 = PG_GETARG_BPCHAR_PP(1);
+ int result;
+
+ result = internal_bpchar_pattern_compare(arg1, arg2);
+
+ PG_FREE_IF_COPY(arg1, 0);
+ PG_FREE_IF_COPY(arg2, 1);
+
+ PG_RETURN_BOOL(result < 0);
+}
+
+
+Datum
+bpchar_pattern_le(PG_FUNCTION_ARGS)
+{
+ BpChar *arg1 = PG_GETARG_BPCHAR_PP(0);
+ BpChar *arg2 = PG_GETARG_BPCHAR_PP(1);
+ int result;
+
+ result = internal_bpchar_pattern_compare(arg1, arg2);
+
+ PG_FREE_IF_COPY(arg1, 0);
+ PG_FREE_IF_COPY(arg2, 1);
+
+ PG_RETURN_BOOL(result <= 0);
+}
+
+
+Datum
+bpchar_pattern_ge(PG_FUNCTION_ARGS)
+{
+ BpChar *arg1 = PG_GETARG_BPCHAR_PP(0);
+ BpChar *arg2 = PG_GETARG_BPCHAR_PP(1);
+ int result;
+
+ result = internal_bpchar_pattern_compare(arg1, arg2);
+
+ PG_FREE_IF_COPY(arg1, 0);
+ PG_FREE_IF_COPY(arg2, 1);
+
+ PG_RETURN_BOOL(result >= 0);
+}
+
+
+Datum
+bpchar_pattern_gt(PG_FUNCTION_ARGS)
+{
+ BpChar *arg1 = PG_GETARG_BPCHAR_PP(0);
+ BpChar *arg2 = PG_GETARG_BPCHAR_PP(1);
+ int result;
+
+ result = internal_bpchar_pattern_compare(arg1, arg2);
+
+ PG_FREE_IF_COPY(arg1, 0);
+ PG_FREE_IF_COPY(arg2, 1);
+
+ PG_RETURN_BOOL(result > 0);
+}
+
+
+Datum
+btbpchar_pattern_cmp(PG_FUNCTION_ARGS)
+{
+ BpChar *arg1 = PG_GETARG_BPCHAR_PP(0);
+ BpChar *arg2 = PG_GETARG_BPCHAR_PP(1);
+ int result;
+
+ result = internal_bpchar_pattern_compare(arg1, arg2);
+
+ PG_FREE_IF_COPY(arg1, 0);
+ PG_FREE_IF_COPY(arg2, 1);
+
+ PG_RETURN_INT32(result);
+}
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 433049ec022..164ff849560 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.166 2008/05/12 00:00:51 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.167 2008/05/27 00:13:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1309,22 +1309,27 @@ text_smaller(PG_FUNCTION_ARGS)
/*
* The following operators support character-by-character comparison
- * of text data types, to allow building indexes suitable for LIKE
- * clauses.
+ * of text datums, to allow building indexes suitable for LIKE clauses.
+ * Note that the regular texteq/textne comparison operators are assumed
+ * to be compatible with these!
*/
static int
internal_text_pattern_compare(text *arg1, text *arg2)
{
int result;
+ int len1,
+ len2;
+
+ len1 = VARSIZE_ANY_EXHDR(arg1);
+ len2 = VARSIZE_ANY_EXHDR(arg2);
- result = memcmp(VARDATA_ANY(arg1), VARDATA_ANY(arg2),
- Min(VARSIZE_ANY_EXHDR(arg1), VARSIZE_ANY_EXHDR(arg2)));
+ result = strncmp(VARDATA_ANY(arg1), VARDATA_ANY(arg2), Min(len1, len2));
if (result != 0)
return result;
- else if (VARSIZE_ANY_EXHDR(arg1) < VARSIZE_ANY_EXHDR(arg2))
+ else if (len1 < len2)
return -1;
- else if (VARSIZE_ANY_EXHDR(arg1) > VARSIZE_ANY_EXHDR(arg2))
+ else if (len1 > len2)
return 1;
else
return 0;
@@ -1364,25 +1369,6 @@ text_pattern_le(PG_FUNCTION_ARGS)
Datum
-text_pattern_eq(PG_FUNCTION_ARGS)
-{
- text *arg1 = PG_GETARG_TEXT_PP(0);
- text *arg2 = PG_GETARG_TEXT_PP(1);
- int result;
-
- if (VARSIZE_ANY_EXHDR(arg1) != VARSIZE_ANY_EXHDR(arg2))
- result = 1;
- else
- result = internal_text_pattern_compare(arg1, arg2);
-
- PG_FREE_IF_COPY(arg1, 0);
- PG_FREE_IF_COPY(arg2, 1);
-
- PG_RETURN_BOOL(result == 0);
-}
-
-
-Datum
text_pattern_ge(PG_FUNCTION_ARGS)
{
text *arg1 = PG_GETARG_TEXT_PP(0);
@@ -1415,25 +1401,6 @@ text_pattern_gt(PG_FUNCTION_ARGS)
Datum
-text_pattern_ne(PG_FUNCTION_ARGS)
-{
- text *arg1 = PG_GETARG_TEXT_PP(0);
- text *arg2 = PG_GETARG_TEXT_PP(1);
- int result;
-
- if (VARSIZE_ANY_EXHDR(arg1) != VARSIZE_ANY_EXHDR(arg2))
- result = 1;
- else
- result = internal_text_pattern_compare(arg1, arg2);
-
- PG_FREE_IF_COPY(arg1, 0);
- PG_FREE_IF_COPY(arg2, 1);
-
- PG_RETURN_BOOL(result != 0);
-}
-
-
-Datum
bttext_pattern_cmp(PG_FUNCTION_ARGS)
{
text *arg1 = PG_GETARG_TEXT_PP(0);
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index e5b87fa864d..31bfd2d7472 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.461 2008/05/16 23:36:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.462 2008/05/27 00:13:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200805162
+#define CATALOG_VERSION_NO 200805261
#endif
diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h
index e48fe154613..8368d4bbc79 100644
--- a/src/include/catalog/pg_amop.h
+++ b/src/include/catalog/pg_amop.h
@@ -29,7 +29,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_amop.h,v 1.86 2008/04/14 17:05:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_amop.h,v 1.87 2008/05/27 00:13:09 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -416,7 +416,7 @@ DATA(insert ( 2002 1562 1562 5 1807 403 ));
DATA(insert ( 2095 25 25 1 2314 403 ));
DATA(insert ( 2095 25 25 2 2315 403 ));
-DATA(insert ( 2095 25 25 3 2316 403 ));
+DATA(insert ( 2095 25 25 3 98 403 ));
DATA(insert ( 2095 25 25 4 2317 403 ));
DATA(insert ( 2095 25 25 5 2318 403 ));
@@ -426,21 +426,11 @@ DATA(insert ( 2095 25 25 5 2318 403 ));
DATA(insert ( 2097 1042 1042 1 2326 403 ));
DATA(insert ( 2097 1042 1042 2 2327 403 ));
-DATA(insert ( 2097 1042 1042 3 2328 403 ));
+DATA(insert ( 2097 1042 1042 3 1054 403 ));
DATA(insert ( 2097 1042 1042 4 2329 403 ));
DATA(insert ( 2097 1042 1042 5 2330 403 ));
/*
- * btree name pattern
- */
-
-DATA(insert ( 2098 19 19 1 2332 403 ));
-DATA(insert ( 2098 19 19 2 2333 403 ));
-DATA(insert ( 2098 19 19 3 2334 403 ));
-DATA(insert ( 2098 19 19 4 2335 403 ));
-DATA(insert ( 2098 19 19 5 2336 403 ));
-
-/*
* btree money_ops
*/
@@ -552,11 +542,9 @@ DATA(insert ( 2227 702 702 1 560 405 ));
/* reltime_ops */
DATA(insert ( 2228 703 703 1 566 405 ));
/* text_pattern_ops */
-DATA(insert ( 2229 25 25 1 2316 405 ));
+DATA(insert ( 2229 25 25 1 98 405 ));
/* bpchar_pattern_ops */
-DATA(insert ( 2231 1042 1042 1 2328 405 ));
-/* name_pattern_ops */
-DATA(insert ( 2232 19 19 1 2334 405 ));
+DATA(insert ( 2231 1042 1042 1 1054 405 ));
/* aclitem_ops */
DATA(insert ( 2235 1033 1033 1 974 405 ));
/* uuid_ops */
diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h
index 36bd0f84096..5ca46600e3e 100644
--- a/src/include/catalog/pg_amproc.h
+++ b/src/include/catalog/pg_amproc.h
@@ -22,7 +22,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_amproc.h,v 1.72 2008/05/16 16:31:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_amproc.h,v 1.73 2008/05/27 00:13:09 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -117,7 +117,6 @@ DATA(insert ( 2000 1266 1266 1 1358 ));
DATA(insert ( 2002 1562 1562 1 1672 ));
DATA(insert ( 2095 25 25 1 2166 ));
DATA(insert ( 2097 1042 1042 1 2180 ));
-DATA(insert ( 2098 19 19 1 2187 ));
DATA(insert ( 2099 790 790 1 377 ));
DATA(insert ( 2233 703 703 1 380 ));
DATA(insert ( 2234 704 704 1 381 ));
@@ -154,9 +153,8 @@ DATA(insert ( 2225 28 28 1 450 ));
DATA(insert ( 2226 29 29 1 450 ));
DATA(insert ( 2227 702 702 1 450 ));
DATA(insert ( 2228 703 703 1 450 ));
-DATA(insert ( 2229 25 25 1 456 ));
-DATA(insert ( 2231 1042 1042 1 456 ));
-DATA(insert ( 2232 19 19 1 455 ));
+DATA(insert ( 2229 25 25 1 400 ));
+DATA(insert ( 2231 1042 1042 1 1080 ));
DATA(insert ( 2235 1033 1033 1 329 ));
DATA(insert ( 2969 2950 2950 1 2963 ));
DATA(insert ( 3523 3500 3500 1 3515 ));
diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h
index 72689257b72..13f66c01baf 100644
--- a/src/include/catalog/pg_opclass.h
+++ b/src/include/catalog/pg_opclass.h
@@ -28,7 +28,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_opclass.h,v 1.80 2008/03/27 03:57:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_opclass.h,v 1.81 2008/05/27 00:13:09 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -146,7 +146,6 @@ DATA(insert ( 405 timestamp_ops PGNSP PGUID 2040 1114 t 0 ));
DATA(insert ( 403 text_pattern_ops PGNSP PGUID 2095 25 f 0 ));
DATA(insert ( 403 varchar_pattern_ops PGNSP PGUID 2095 25 f 0 ));
DATA(insert ( 403 bpchar_pattern_ops PGNSP PGUID 2097 1042 f 0 ));
-DATA(insert ( 403 name_pattern_ops PGNSP PGUID 2098 19 f 0 ));
DATA(insert ( 403 money_ops PGNSP PGUID 2099 790 t 0 ));
DATA(insert ( 405 bool_ops PGNSP PGUID 2222 16 t 0 ));
DATA(insert ( 405 bytea_ops PGNSP PGUID 2223 17 t 0 ));
@@ -159,7 +158,6 @@ DATA(insert ( 405 reltime_ops PGNSP PGUID 2228 703 t 0 ));
DATA(insert ( 405 text_pattern_ops PGNSP PGUID 2229 25 f 0 ));
DATA(insert ( 405 varchar_pattern_ops PGNSP PGUID 2229 25 f 0 ));
DATA(insert ( 405 bpchar_pattern_ops PGNSP PGUID 2231 1042 f 0 ));
-DATA(insert ( 405 name_pattern_ops PGNSP PGUID 2232 19 f 0 ));
DATA(insert ( 403 reltime_ops PGNSP PGUID 2233 703 t 0 ));
DATA(insert ( 403 tinterval_ops PGNSP PGUID 2234 704 t 0 ));
DATA(insert ( 405 aclitem_ops PGNSP PGUID 2235 1033 t 0 ));
diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h
index 567d95be56a..c9f05ec9644 100644
--- a/src/include/catalog/pg_operator.h
+++ b/src/include/catalog/pg_operator.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.158 2008/03/27 03:57:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.159 2008/05/27 00:13:09 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -778,24 +778,13 @@ DATA(insert OID = 2068 ( "-" PGNSP PGUID b f f 1114 1186 1114 0 0 timestamp
DATA(insert OID = 2314 ( "~<~" PGNSP PGUID b f f 25 25 16 2318 2317 text_pattern_lt scalarltsel scalarltjoinsel ));
DATA(insert OID = 2315 ( "~<=~" PGNSP PGUID b f f 25 25 16 2317 2318 text_pattern_le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 2316 ( "~=~" PGNSP PGUID b t t 25 25 16 2316 2319 text_pattern_eq eqsel eqjoinsel ));
DATA(insert OID = 2317 ( "~>=~" PGNSP PGUID b f f 25 25 16 2315 2314 text_pattern_ge scalargtsel scalargtjoinsel ));
DATA(insert OID = 2318 ( "~>~" PGNSP PGUID b f f 25 25 16 2314 2315 text_pattern_gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 2319 ( "~<>~" PGNSP PGUID b f f 25 25 16 2319 2316 text_pattern_ne neqsel neqjoinsel ));
DATA(insert OID = 2326 ( "~<~" PGNSP PGUID b f f 1042 1042 16 2330 2329 bpchar_pattern_lt scalarltsel scalarltjoinsel ));
DATA(insert OID = 2327 ( "~<=~" PGNSP PGUID b f f 1042 1042 16 2329 2330 bpchar_pattern_le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 2328 ( "~=~" PGNSP PGUID b t t 1042 1042 16 2328 2331 bpchar_pattern_eq eqsel eqjoinsel ));
DATA(insert OID = 2329 ( "~>=~" PGNSP PGUID b f f 1042 1042 16 2327 2326 bpchar_pattern_ge scalargtsel scalargtjoinsel ));
DATA(insert OID = 2330 ( "~>~" PGNSP PGUID b f f 1042 1042 16 2326 2327 bpchar_pattern_gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 2331 ( "~<>~" PGNSP PGUID b f f 1042 1042 16 2331 2328 bpchar_pattern_ne neqsel neqjoinsel ));
-
-DATA(insert OID = 2332 ( "~<~" PGNSP PGUID b f f 19 19 16 2336 2335 name_pattern_lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 2333 ( "~<=~" PGNSP PGUID b f f 19 19 16 2335 2336 name_pattern_le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 2334 ( "~=~" PGNSP PGUID b t t 19 19 16 2334 2337 name_pattern_eq eqsel eqjoinsel ));
-DATA(insert OID = 2335 ( "~>=~" PGNSP PGUID b f f 19 19 16 2333 2332 name_pattern_ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 2336 ( "~>~" PGNSP PGUID b f f 19 19 16 2332 2333 name_pattern_gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 2337 ( "~<>~" PGNSP PGUID b f f 19 19 16 2337 2334 name_pattern_ne neqsel neqjoinsel ));
/* crosstype operations for date vs. timestamp and timestamptz */
diff --git a/src/include/catalog/pg_opfamily.h b/src/include/catalog/pg_opfamily.h
index 3fd314fd526..e6066f06566 100644
--- a/src/include/catalog/pg_opfamily.h
+++ b/src/include/catalog/pg_opfamily.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_opfamily.h,v 1.8 2008/03/27 03:57:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_opfamily.h,v 1.9 2008/05/27 00:13:09 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -108,8 +108,6 @@ DATA(insert OID = 2095 ( 403 text_pattern_ops PGNSP PGUID ));
#define TEXT_PATTERN_BTREE_FAM_OID 2095
DATA(insert OID = 2097 ( 403 bpchar_pattern_ops PGNSP PGUID ));
#define BPCHAR_PATTERN_BTREE_FAM_OID 2097
-DATA(insert OID = 2098 ( 403 name_pattern_ops PGNSP PGUID ));
-#define NAME_PATTERN_BTREE_FAM_OID 2098
DATA(insert OID = 2099 ( 403 money_ops PGNSP PGUID ));
DATA(insert OID = 2222 ( 405 bool_ops PGNSP PGUID ));
#define BOOL_HASH_FAM_OID 2222
@@ -122,7 +120,6 @@ DATA(insert OID = 2227 ( 405 abstime_ops PGNSP PGUID ));
DATA(insert OID = 2228 ( 405 reltime_ops PGNSP PGUID ));
DATA(insert OID = 2229 ( 405 text_pattern_ops PGNSP PGUID ));
DATA(insert OID = 2231 ( 405 bpchar_pattern_ops PGNSP PGUID ));
-DATA(insert OID = 2232 ( 405 name_pattern_ops PGNSP PGUID ));
DATA(insert OID = 2233 ( 403 reltime_ops PGNSP PGUID ));
DATA(insert OID = 2234 ( 403 tinterval_ops PGNSP PGUID ));
DATA(insert OID = 2235 ( 405 aclitem_ops PGNSP PGUID ));
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 21e094ad570..5aa1db331cc 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.500 2008/05/16 16:31:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.501 2008/05/27 00:13:09 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -3326,28 +3326,15 @@ DATA(insert OID = 2829 ( corr PGNSP PGUID 12 1 0 t f f f i 2 701 "701 701" _
DATA(insert OID = 2160 ( text_pattern_lt PGNSP PGUID 12 1 0 f f t f i 2 16 "25 25" _null_ _null_ _null_ text_pattern_lt - _null_ _null_ ));
DATA(insert OID = 2161 ( text_pattern_le PGNSP PGUID 12 1 0 f f t f i 2 16 "25 25" _null_ _null_ _null_ text_pattern_le - _null_ _null_ ));
-DATA(insert OID = 2162 ( text_pattern_eq PGNSP PGUID 12 1 0 f f t f i 2 16 "25 25" _null_ _null_ _null_ text_pattern_eq - _null_ _null_ ));
DATA(insert OID = 2163 ( text_pattern_ge PGNSP PGUID 12 1 0 f f t f i 2 16 "25 25" _null_ _null_ _null_ text_pattern_ge - _null_ _null_ ));
DATA(insert OID = 2164 ( text_pattern_gt PGNSP PGUID 12 1 0 f f t f i 2 16 "25 25" _null_ _null_ _null_ text_pattern_gt - _null_ _null_ ));
-DATA(insert OID = 2165 ( text_pattern_ne PGNSP PGUID 12 1 0 f f t f i 2 16 "25 25" _null_ _null_ _null_ text_pattern_ne - _null_ _null_ ));
DATA(insert OID = 2166 ( bttext_pattern_cmp PGNSP PGUID 12 1 0 f f t f i 2 23 "25 25" _null_ _null_ _null_ bttext_pattern_cmp - _null_ _null_ ));
-/* We use the same procedures here as above since the types are binary compatible. */
-DATA(insert OID = 2174 ( bpchar_pattern_lt PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ text_pattern_lt - _null_ _null_ ));
-DATA(insert OID = 2175 ( bpchar_pattern_le PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ text_pattern_le - _null_ _null_ ));
-DATA(insert OID = 2176 ( bpchar_pattern_eq PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ text_pattern_eq - _null_ _null_ ));
-DATA(insert OID = 2177 ( bpchar_pattern_ge PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ text_pattern_ge - _null_ _null_ ));
-DATA(insert OID = 2178 ( bpchar_pattern_gt PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ text_pattern_gt - _null_ _null_ ));
-DATA(insert OID = 2179 ( bpchar_pattern_ne PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ text_pattern_ne - _null_ _null_ ));
-DATA(insert OID = 2180 ( btbpchar_pattern_cmp PGNSP PGUID 12 1 0 f f t f i 2 23 "1042 1042" _null_ _null_ _null_ bttext_pattern_cmp - _null_ _null_ ));
-
-DATA(insert OID = 2181 ( name_pattern_lt PGNSP PGUID 12 1 0 f f t f i 2 16 "19 19" _null_ _null_ _null_ name_pattern_lt - _null_ _null_ ));
-DATA(insert OID = 2182 ( name_pattern_le PGNSP PGUID 12 1 0 f f t f i 2 16 "19 19" _null_ _null_ _null_ name_pattern_le - _null_ _null_ ));
-DATA(insert OID = 2183 ( name_pattern_eq PGNSP PGUID 12 1 0 f f t f i 2 16 "19 19" _null_ _null_ _null_ name_pattern_eq - _null_ _null_ ));
-DATA(insert OID = 2184 ( name_pattern_ge PGNSP PGUID 12 1 0 f f t f i 2 16 "19 19" _null_ _null_ _null_ name_pattern_ge - _null_ _null_ ));
-DATA(insert OID = 2185 ( name_pattern_gt PGNSP PGUID 12 1 0 f f t f i 2 16 "19 19" _null_ _null_ _null_ name_pattern_gt - _null_ _null_ ));
-DATA(insert OID = 2186 ( name_pattern_ne PGNSP PGUID 12 1 0 f f t f i 2 16 "19 19" _null_ _null_ _null_ name_pattern_ne - _null_ _null_ ));
-DATA(insert OID = 2187 ( btname_pattern_cmp PGNSP PGUID 12 1 0 f f t f i 2 23 "19 19" _null_ _null_ _null_ btname_pattern_cmp - _null_ _null_ ));
+DATA(insert OID = 2174 ( bpchar_pattern_lt PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ bpchar_pattern_lt - _null_ _null_ ));
+DATA(insert OID = 2175 ( bpchar_pattern_le PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ bpchar_pattern_le - _null_ _null_ ));
+DATA(insert OID = 2177 ( bpchar_pattern_ge PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ bpchar_pattern_ge - _null_ _null_ ));
+DATA(insert OID = 2178 ( bpchar_pattern_gt PGNSP PGUID 12 1 0 f f t f i 2 16 "1042 1042" _null_ _null_ _null_ bpchar_pattern_gt - _null_ _null_ ));
+DATA(insert OID = 2180 ( btbpchar_pattern_cmp PGNSP PGUID 12 1 0 f f t f i 2 23 "1042 1042" _null_ _null_ _null_ btbpchar_pattern_cmp - _null_ _null_ ));
DATA(insert OID = 2188 ( btint48cmp PGNSP PGUID 12 1 0 f f t f i 2 23 "23 20" _null_ _null_ _null_ btint48cmp - _null_ _null_ ));
DATA(insert OID = 2189 ( btint84cmp PGNSP PGUID 12 1 0 f f t f i 2 23 "20 23" _null_ _null_ _null_ btint84cmp - _null_ _null_ ));
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 1a652c6de3d..e152fe671ab 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.315 2008/04/17 20:56:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.316 2008/05/27 00:13:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -224,12 +224,6 @@ extern Datum namelt(PG_FUNCTION_ARGS);
extern Datum namele(PG_FUNCTION_ARGS);
extern Datum namegt(PG_FUNCTION_ARGS);
extern Datum namege(PG_FUNCTION_ARGS);
-extern Datum name_pattern_eq(PG_FUNCTION_ARGS);
-extern Datum name_pattern_ne(PG_FUNCTION_ARGS);
-extern Datum name_pattern_lt(PG_FUNCTION_ARGS);
-extern Datum name_pattern_le(PG_FUNCTION_ARGS);
-extern Datum name_pattern_gt(PG_FUNCTION_ARGS);
-extern Datum name_pattern_ge(PG_FUNCTION_ARGS);
extern int namecpy(Name n1, Name n2);
extern int namestrcpy(Name name, const char *str);
extern int namestrcmp(Name name, const char *str);
@@ -269,8 +263,6 @@ extern Datum bttintervalcmp(PG_FUNCTION_ARGS);
extern Datum btcharcmp(PG_FUNCTION_ARGS);
extern Datum btnamecmp(PG_FUNCTION_ARGS);
extern Datum bttextcmp(PG_FUNCTION_ARGS);
-extern Datum btname_pattern_cmp(PG_FUNCTION_ARGS);
-extern Datum bttext_pattern_cmp(PG_FUNCTION_ARGS);
/* float.c */
extern PGDLLIMPORT int extra_float_digits;
@@ -609,6 +601,11 @@ extern Datum bpchar_smaller(PG_FUNCTION_ARGS);
extern Datum bpcharlen(PG_FUNCTION_ARGS);
extern Datum bpcharoctetlen(PG_FUNCTION_ARGS);
extern Datum hashbpchar(PG_FUNCTION_ARGS);
+extern Datum bpchar_pattern_lt(PG_FUNCTION_ARGS);
+extern Datum bpchar_pattern_le(PG_FUNCTION_ARGS);
+extern Datum bpchar_pattern_gt(PG_FUNCTION_ARGS);
+extern Datum bpchar_pattern_ge(PG_FUNCTION_ARGS);
+extern Datum btbpchar_pattern_cmp(PG_FUNCTION_ARGS);
extern Datum varcharin(PG_FUNCTION_ARGS);
extern Datum varcharout(PG_FUNCTION_ARGS);
@@ -640,12 +637,11 @@ extern Datum text_gt(PG_FUNCTION_ARGS);
extern Datum text_ge(PG_FUNCTION_ARGS);
extern Datum text_larger(PG_FUNCTION_ARGS);
extern Datum text_smaller(PG_FUNCTION_ARGS);
-extern Datum text_pattern_eq(PG_FUNCTION_ARGS);
-extern Datum text_pattern_ne(PG_FUNCTION_ARGS);
extern Datum text_pattern_lt(PG_FUNCTION_ARGS);
extern Datum text_pattern_le(PG_FUNCTION_ARGS);
extern Datum text_pattern_gt(PG_FUNCTION_ARGS);
extern Datum text_pattern_ge(PG_FUNCTION_ARGS);
+extern Datum bttext_pattern_cmp(PG_FUNCTION_ARGS);
extern Datum textlen(PG_FUNCTION_ARGS);
extern Datum textoctetlen(PG_FUNCTION_ARGS);
extern Datum textpos(PG_FUNCTION_ARGS);
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out
index efab1354fe3..2f7a3515ffd 100644
--- a/src/test/regress/expected/opr_sanity.out
+++ b/src/test/regress/expected/opr_sanity.out
@@ -139,11 +139,10 @@ WHERE p1.oid != p2.oid AND
proargtypes | proargtypes
-------------+-------------
23 | 28
- 25 | 1042
1114 | 1184
1560 | 1562
2277 | 2283
-(5 rows)
+(4 rows)
SELECT DISTINCT p1.proargtypes[2], p2.proargtypes[2]
FROM pg_proc AS p1, pg_proc AS p2
@@ -774,13 +773,11 @@ ORDER BY 1, 2, 3;
403 | 2 | <=
403 | 2 | ~<=~
403 | 3 | =
- 403 | 3 | ~=~
403 | 4 | >=
403 | 4 | ~>=~
403 | 5 | >
403 | 5 | ~>~
405 | 1 | =
- 405 | 1 | ~=~
783 | 1 | <<
783 | 1 | @@
783 | 2 | &<
@@ -802,7 +799,7 @@ ORDER BY 1, 2, 3;
2742 | 2 | @@@
2742 | 3 | <@
2742 | 4 | =
-(33 rows)
+(31 rows)
-- Check that all operators linked to by opclass entries have selectivity
-- estimators. This is not absolutely required, but it seems a reasonable
@@ -1041,17 +1038,15 @@ WHERE p3.opfmethod = (SELECT oid FROM pg_am WHERE amname = 'hash')
OR NOT physically_coercible(amproclefttype, proargtypes[0])
OR amproclefttype != amprocrighttype)
ORDER BY 1;
- amprocfamily | amprocnum | proname | opfname
---------------+-----------+----------------+--------------------
+ amprocfamily | amprocnum | proname | opfname
+--------------+-----------+----------------+-----------------
435 | 1 | hashint4 | date_ops
1999 | 1 | timestamp_hash | timestamptz_ops
2222 | 1 | hashchar | bool_ops
2223 | 1 | hashvarlena | bytea_ops
2225 | 1 | hashint4 | xid_ops
2226 | 1 | hashint4 | cid_ops
- 2229 | 1 | hashvarlena | text_pattern_ops
- 2231 | 1 | hashvarlena | bpchar_pattern_ops
-(8 rows)
+(6 rows)
-- Support routines that are primary members of opfamilies must be immutable
-- (else it suggests that the index ordering isn't fixed). But cross-type