Alter the xxx_pattern_ops opclasses to use the regular equality operator of
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 27 May 2008 00:13:09 +0000 (00:13 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 27 May 2008 00:13:09 +0000 (00:13 +0000)
the associated datatype as their equality member.  This means that these
opclasses can now support plain equality comparisons along with LIKE tests,
thus avoiding the need for an extra index in some applications.  This
optimization was not possible when the pattern opclasses were first introduced,
because we didn't insist that text equality meant bitwise equality; but we
do now, so there is no semantic difference between regular and pattern
equality operators.

I removed the name_pattern_ops opclass altogether, since it's really useless:
name's regular comparisons are just strcmp() and are unlikely to become
something different.  Instead teach indxpath.c that btree name_ops can be
used for LIKE whether or not the locale is C.  This might lead to a useful
speedup in LIKE queries on the system catalogs in non-C locales.

The ~=~ and ~<>~ operators are gone altogether.  (It would have been nice to
keep them for backward compatibility's sake, but since the pg_amop structure
doesn't allow multiple equality operators per opclass, there's no way.)

A not-immediately-obvious incompatibility is that the sort order within
bpchar_pattern_ops indexes changes --- it had been identical to plain
strcmp, but is now trailing-blank-insensitive.  This will impact
in-place upgrades, if those ever happen.

Per discussions a couple months ago.

15 files changed:
doc/src/sgml/indices.sgml
src/backend/access/nbtree/nbtcompare.c
src/backend/optimizer/path/indxpath.c
src/backend/utils/adt/name.c
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varlena.c
src/include/catalog/catversion.h
src/include/catalog/pg_amop.h
src/include/catalog/pg_amproc.h
src/include/catalog/pg_opclass.h
src/include/catalog/pg_operator.h
src/include/catalog/pg_opfamily.h
src/include/catalog/pg_proc.h
src/include/utils/builtins.h
src/test/regress/expected/opr_sanity.out

index b10e2c2f395910123ae26e696481134b2f7be976..11c5b50e7cc8a8558614464a8f58a28f5c369778 100644 (file)
@@ -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>
index 4750bc72583b6548f93fc51c35eea6d7f307ec1a..3859afdeb4ada59632ffd0cabfe16c287e5c6453 100644 (file)
@@ -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));
-}
index f294b22c1b2054128cd1420f50e7a45a73ecb9cc..45175004ba41c8e59ba72a86efbfa95d0bb5917d 100644 (file)
@@ -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;
 
index 586a772a0703d598fc85494b968f32b3feba55bc..684d9147a6e0a75d738abbd1473f4b043119dfd6 100644 (file)
@@ -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
index 95b26834b47a09de4b679a8749b984e7e395f402..f4fc20babb0db9a2ad64992d09354f7243020024 100644 (file)
@@ -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);
+}
index 3289c395da738a01eb2270b7047d9beaa3be2fd2..5fa10bea39ff252ad835b27a90148d4c7546b26f 100644 (file)
@@ -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;
@@ -1363,25 +1368,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)
 {
@@ -1414,25 +1400,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)
 {
index 49560b1860366effc6d7a855e8cd1609969fe03e..ff4ce32ea5d38fcaf2626d4a88d49a39a2d82158 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     200805162
+#define CATALOG_VERSION_NO     200805261
 
 #endif
index 1edcd64285b820539d7f09d3a6cb37ea73434803..9f1de8958cd3bd3f0d3bd0023681894e1cde540c 100644 (file)
@@ -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,20 +426,10 @@ 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 */
index de361cae6abe882aa8b9910fc99371ae5e84cec3..44ec1953e4c8edc08b0a60dfc2dc6b7e9d516055 100644 (file)
@@ -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 ));
index 2f56df38bbbee499d33a4f97ae5a618b21c8c83d..543d0a1ae1d187c031689f1a112027c471441369 100644 (file)
@@ -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 ));
index eea0677e85ae671ecf112e81ecbfceac134b13ab..0af47ac210186cd3e4eaab83a5621f1cb7693894 100644 (file)
@@ -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 */
 
index 89583031e2c8516a85389bbfc374174de429e20d..0dd11fb157deae309c1b7086ca17f2951162ea3b 100644 (file)
@@ -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 ));
index 6d9299f36572ed367492869195d4c5678ba4f8e4..87bf580759f1b18c5483db320ac603c14d98a4c4 100644 (file)
@@ -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_ ));
index e6d478ddde11152a5be851857f7803cd4a8777e4..91869d9b2a2635e32ed1f33f6011edc99dc51de3 100644 (file)
@@ -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);
index efab1354fe38e02687d37ea44f51d38194701126..2f7a3515ffd26a12086ea5546d5aa5246af924e7 100644 (file)
@@ -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