Skip site navigation (1) Skip section navigation (2)

pgsql: Alter the xxx_pattern_ops opclasses to use the regular equality

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Alter the xxx_pattern_ops opclasses to use the regular equality
Date: 2008-05-27 00:13:09
Message-ID: 20080527001310.0599E754C54@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Alter the xxx_pattern_ops opclasses to use the regular equality operator of
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.

Modified Files:
--------------
    pgsql/doc/src/sgml:
        indices.sgml (r1.72 -> r1.73)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/indices.sgml?r1=1.72&r2=1.73)
    pgsql/src/backend/access/nbtree:
        nbtcompare.c (r1.55 -> r1.56)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtcompare.c?r1=1.55&r2=1.56)
    pgsql/src/backend/optimizer/path:
        indxpath.c (r1.230 -> r1.231)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/indxpath.c?r1=1.230&r2=1.231)
    pgsql/src/backend/utils/adt:
        name.c (r1.61 -> r1.62)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/name.c?r1=1.61&r2=1.62)
        varchar.c (r1.128 -> r1.129)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/varchar.c?r1=1.128&r2=1.129)
        varlena.c (r1.166 -> r1.167)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/varlena.c?r1=1.166&r2=1.167)
    pgsql/src/include/catalog:
        catversion.h (r1.461 -> r1.462)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.461&r2=1.462)
        pg_amop.h (r1.86 -> r1.87)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_amop.h?r1=1.86&r2=1.87)
        pg_amproc.h (r1.72 -> r1.73)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_amproc.h?r1=1.72&r2=1.73)
        pg_opclass.h (r1.80 -> r1.81)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_opclass.h?r1=1.80&r2=1.81)
        pg_operator.h (r1.158 -> r1.159)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_operator.h?r1=1.158&r2=1.159)
        pg_opfamily.h (r1.8 -> r1.9)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_opfamily.h?r1=1.8&r2=1.9)
        pg_proc.h (r1.500 -> r1.501)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h?r1=1.500&r2=1.501)
    pgsql/src/include/utils:
        builtins.h (r1.315 -> r1.316)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/builtins.h?r1=1.315&r2=1.316)
    pgsql/src/test/regress/expected:
        opr_sanity.out (r1.80 -> r1.81)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/opr_sanity.out?r1=1.80&r2=1.81)

pgsql-committers by date

Next:From: Magnus HaganderDate: 2008-05-27 12:24:42
Subject: pgsql: Explicitly bind gettext() to the UTF8 locale when in use.
Previous:From: User JdavisDate: 2008-05-26 19:12:48
Subject: temporal - temporal: added notice that the repository has moved to

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group