postgresql/src/include/utils
Peter Eisentraut 5e1963fb76 Collations with nondeterministic comparison
This adds a flag "deterministic" to collations.  If that is false,
such a collation disables various optimizations that assume that
strings are equal only if they are byte-wise equal.  That then allows
use cases such as case-insensitive or accent-insensitive comparisons
or handling of strings with different Unicode normal forms.

This functionality is only supported with the ICU provider.  At least
glibc doesn't appear to have any locales that work in a
nondeterministic way, so it's not worth supporting this for the libc
provider.

The term "deterministic comparison" in this context is from Unicode
Technical Standard #10
(https://unicode.org/reports/tr10/#Deterministic_Comparison).

This patch makes changes in three areas:

- CREATE COLLATION DDL changes and system catalog changes to support
  this new flag.

- Many executor nodes and auxiliary code are extended to track
  collations.  Previously, this code would just throw away collation
  information, because the eventually-called user-defined functions
  didn't use it since they only cared about equality, which didn't
  need collation information.

- String data type functions that do equality comparisons and hashing
  are changed to take the (non-)deterministic flag into account.  For
  comparison, this just means skipping various shortcuts and tie
  breakers that use byte-wise comparison.  For hashing, we first need
  to convert the input string to a canonical "sort key" using the ICU
  analogue of strxfrm().

Reviewed-by: Daniel Verite <daniel@manitou-mail.org>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/flat/1ccc668f-4cbc-0bef-af67-450b47cdfee7@2ndquadrant.com
2019-03-22 12:12:43 +01:00
..
.gitignore Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
acl.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
aclchk_internal.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
array.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
arrayaccess.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
ascii.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
attoptcache.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
builtins.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
bytea.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
cash.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catcache.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
combocid.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
date.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
datetime.h Create the infrastructure for planner support functions. 2019-02-09 18:08:48 -05:00
datum.h Fix optimization of foreign-key on update actions 2019-03-18 17:19:21 +01:00
dsa.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
dynahash.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
elog.h Fix misleading PG_RE_THROW commentary 2019-02-11 15:56:09 -03:00
evtcache.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
expandeddatum.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
expandedrecord.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
float.h Numeric error suppression in jsonpath 2019-03-16 12:21:19 +03:00
fmgrtab.h Reduce the size of the fmgr_builtin_oid_index[] array. 2019-01-09 15:22:43 -05:00
formatting.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
freepage.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
geo_decls.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
guc.h Convert [autovacuum_]vacuum_cost_delay into floating-point GUCs. 2019-03-10 15:01:39 -04:00
guc_tables.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
hashutils.h Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
help_config.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
hsearch.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
index_selfuncs.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
inet.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
int8.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
inval.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
json.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
jsonapi.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
jsonb.h Partial implementation of SQL/JSON path language 2019-03-16 12:16:48 +03:00
jsonpath.h Partial implementation of SQL/JSON path language 2019-03-16 12:16:48 +03:00
logtape.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
lsyscache.h Collations with nondeterministic comparison 2019-03-22 12:12:43 +01:00
memdebug.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
memutils.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
numeric.h Numeric error suppression in jsonpath 2019-03-16 12:21:19 +03:00
palloc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
partcache.h Move code for managing PartitionDescs into a new file, partdesc.c 2019-02-21 11:45:02 -05:00
pg_crc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_locale.h Collations with nondeterministic comparison 2019-03-22 12:12:43 +01:00
pg_lsn.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_rusage.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pidfile.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
plancache.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
portal.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
ps_status.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
queryenvironment.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
rangetypes.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
regproc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
rel.h Convert [autovacuum_]vacuum_cost_delay into floating-point GUCs. 2019-03-10 15:01:39 -04:00
relcache.h tableam: introduce table AM infrastructure. 2019-03-06 09:54:38 -08:00
relfilenodemap.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
relmapper.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
relptr.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
reltrigger.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
resowner.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
resowner_private.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
rls.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
ruleutils.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
sampling.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
selfuncs.h Move estimate_hashagg_tablesize to selfuncs.c, and widen result to double. 2019-02-21 14:59:12 -05:00
sharedtuplestore.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
snapmgr.h Move generic snapshot related code from tqual.h to snapmgr.h. 2019-01-21 17:06:41 -08:00
snapshot.h Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c. 2019-01-21 17:07:10 -08:00
sortsupport.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
spccache.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
syscache.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
timeout.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
timestamp.h Avoid some table rewrites for ALTER TABLE .. SET DATA TYPE timestamp. 2019-03-08 20:16:27 -08:00
tuplesort.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tuplestore.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
typcache.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tzparser.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
uuid.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
varbit.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
varlena.h Fix C++ compile failures in headers. 2019-01-10 14:07:01 -05:00
xml.h Update copyright for 2019 2019-01-02 12:44:25 -05:00