]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix up handling of nondeterministic collations with pattern_ops opclasses.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 21 Sep 2019 20:29:17 +0000 (16:29 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 21 Sep 2019 20:29:17 +0000 (16:29 -0400)
commitd3c61e88d94cba2070574dccbfba06bbc738c876
tree3aff99a0f26387ee86412bb2cc8b2e6e5d99cded
parent25f9368304e41c8837f59e94b161f07ac4c7d622
Fix up handling of nondeterministic collations with pattern_ops opclasses.

text_pattern_ops and its siblings can't be used with nondeterministic
collations, because they use the text_eq operator which will not behave
as bitwise equality if applied with a nondeterministic collation.  The
initial implementation of that restriction was to insert a run-time test
in the related comparison functions, but that is inefficient, may throw
misleading errors, and will throw errors in some cases that would work.
It seems sufficient to just prevent the combination during CREATE INDEX,
so do that instead.

Lacking any better way to identify the opclasses involved, we need to
hard-wire tests for them, which requires hand-assigned values for their
OIDs, which forces a catversion bump because they previously had OIDs
that would be assigned automatically.  That's slightly annoying in the
v12 branch, but fortunately we're not at rc1 yet, so just do it.

Back-patch to v12 where nondeterministic collations were added.

In passing, run make reformat-dat-files, which found some unrelated
whitespace issues (slightly different ones in HEAD and v12).

Peter Eisentraut, with small corrections by me

Discussion: https://postgr.es/m/22566.1568675619@sss.pgh.pa.us
src/backend/catalog/index.c
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varlena.c
src/include/catalog/catversion.h
src/include/catalog/pg_opclass.dat
src/include/catalog/pg_proc.dat