mariadb/include
Alexander Barkov 8020b1bd73 MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations
- Adding a new argument "flag" to MY_COLLATION_HANDLER::strnncollsp_nchars()
  and a flag MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES.
  The flag defines if strnncollsp_nchars() should emulate trailing spaces
  which were possibly trimmed earlier (e.g. in InnoDB CHAR compression).
  This is important for NOPAD collations.

  For example, with this input:
   - str1= 'a '    (Latin letter a followed by one space)
   - str2= 'a  '   (Latin letter a followed by two spaces)
   - nchars= 3
  if the flag is given, strnncollsp_nchars() will virtually restore
  one trailing space to str1 up to nchars (3) characters and compare two
  strings as equal:
  - str1= 'a  '  (one extra trailing space emulated)
  - str2= 'a  '  (as is)

  If the flag is not given, strnncollsp_nchars() does not add trailing
  virtual spaces, so in case of a NOPAD collation, str1 will be compared
  as less than str2 because it is shorter.

- Field_string::cmp_prefix() now passes the new flag.
  Field_varstring::cmp_prefix() and Field_blob::cmp_prefix() do
  not pass the new flag.

- The branch in cmp_whole_field() in storage/innobase/rem/rem0cmp.cc
  (which handles the CHAR data type) now also passed the new flag.

- Fixing UCA collations to respect the new flag.
  Other collations are possibly also affected, however
  I had no success in making an SQL script demonstrating the problem.
  Other collations will be extended to respect this flags in a separate
  patch later.

- Changing the meaning of the last parameter of Field::cmp_prefix()
  from "number of bytes" (internal length)
  to "number of characters" (user visible length).

  The code calling cmp_prefix() from handler.cc was wrong.
  After this change, the call in handler.cc became correct.

  The code calling cmp_prefix() from key_rec_cmp() in key.cc
  was adjusted according to this change.

- Old strnncollsp_nchar() related tests in unittest/strings/strings-t.c
  now pass the new flag.
  A few new tests also were added, without the flag.
2023-04-04 12:30:50 +04:00
..
atomic
mysql
aria_backup.h
big_endian.h
byte_order_generic.h
byte_order_generic_x86.h
byte_order_generic_x86_64.h
CMakeLists.txt
decimal.h
dur_prop.h
errmsg.h
ft_global.h
handler_ername.h
handler_state.h
hash.h
heap.h
ilist.h
json_lib.h
keycache.h
lf.h
little_endian.h
m_ctype.h MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations 2023-04-04 12:30:50 +04:00
m_string.h
ma_dyncol.h
maria.h
mariadb_capi_rename.h
my_alarm.h
my_alloc.h
my_alloca.h
my_atomic.h
my_atomic_wrapper.h
my_attribute.h
my_base.h
my_bit.h
my_bitmap.h
my_byteorder.h
my_check_opt.h
my_compare.h
my_compiler.h
my_context.h
my_counter.h
my_cpu.h
my_crypt.h
my_dbug.h
my_decimal_limits.h
my_default.h
my_dir.h
my_getopt.h
my_global.h
my_handler_errors.h
my_libwrap.h
my_list.h
my_md5.h
my_minidump.h
my_net.h
my_nosys.h
my_pthread.h
my_rdtsc.h
my_rnd.h
my_service_manager.h
my_stacktrace.h
my_sys.h
my_time.h
my_tree.h
my_uctype.h
my_user.h
my_valgrind.h
my_xml.h
myisam.h
myisamchk.h
myisammrg.h
myisampack.h
mysql.h
mysql_async.h
mysql_com.h
mysql_com_server.h
mysql_embed.h
mysql_time.h
mysql_version.h.in
mysqld_default_groups.h
mysys_err.h
pack.h
password.h
probes_mysql.d.base
probes_mysql.h
probes_mysql_nodtrace.h.in
queues.h
rijndael.h
scope.h
service_versions.h
source_revision.h.in
span.h
sql_common.h
ssl_compat.h
sslopt-case.h
sslopt-longopts.h
sslopt-vars.h
t_ctype.h
thr_alarm.h
thr_lock.h
thr_timer.h
thread_pool_priv.h
typelib.h
violite.h
waiting_threads.h
welcome_copyright_notice.h
wqueue.h
wsrep.h