Commit graph

196473 commits

Author SHA1 Message Date
Alexander Barkov
133446828c MDEV-27009 Add UCA-14.0.0 collations
- Added one neutral and 22 tailored (language specific) collations based on
  Unicode Collation Algorithm version 14.0.0.

  Collations were added for Unicode character sets
  utf8mb3, utf8mb4, ucs2, utf16, utf32.

  Every tailoring was added with four accent and case
  sensitivity flag combinations, e.g:

  * utf8mb4_uca1400_swedish_as_cs
  * utf8mb4_uca1400_swedish_as_ci
  * utf8mb4_uca1400_swedish_ai_cs
  * utf8mb4_uca1400_swedish_ai_ci

  and their _nopad_ variants:

  * utf8mb4_uca1400_swedish_nopad_as_cs
  * utf8mb4_uca1400_swedish_nopad_as_ci
  * utf8mb4_uca1400_swedish_nopad_ai_cs
  * utf8mb4_uca1400_swedish_nopad_ai_ci

- Introducing a conception of contextually typed named collations:

  CREATE DATABASE db1 CHARACTER SET utf8mb4;
  CREATE TABLE db1.t1 (a CHAR(10) COLLATE uca1400_as_ci);

  The idea is that there is no a need to specify the character set prefix
  in the new collation names. It's enough to type just the suffix
  "uca1400_as_ci". The character set is taken from the context.

  In the above example script the context character set is utf8mb4.
  So the CREATE TABLE will make a column with the collation
  utf8mb4_uca1400_as_ci.

  Short collations names can be used in any parts of the SQL syntax
  where the COLLATE clause is understood.

- New collations are displayed only one time
  (without character set combinations) by these statements:

     SELECT * FROM INFORMATION_SCHEMA.COLLATIONS;
     SHOW COLLATION;

  For example, all these collations:
  - utf8mb3_uca1400_swedish_as_ci
  - utf8mb4_uca1400_swedish_as_ci
  - ucs2_uca1400_swedish_as_ci
  - utf16_uca1400_swedish_as_ci
  - utf32_uca1400_swedish_as_ci
  have just one entry in INFORMATION_SCHEMA.COLLATIONS and SHOW COLLATION,
  with COLLATION_NAME equal to "uca1400_swedish_as_ci", which is the suffix
  without the character set name:

SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.COLLATIONS
WHERE COLLATION_NAME LIKE '%uca1400_swedish_as_ci';

+-----------------------+
| COLLATION_NAME        |
+-----------------------+
| uca1400_swedish_as_ci |
+-----------------------+

  Note, the behaviour of old collations did not change.
  Non-unicode collations (e.g. latin1_swedish_ci) and
  old UCA-4.0.0 collations (e.g. utf8mb4_unicode_ci)
  are still displayed with the character set prefix, as before.

- The structure of the table INFORMATION_SCHEMA.COLLATIONS was changed.

  The NOT NULL constraint was removed from these columns:
  - CHARACTER_SET_NAME
  - ID
  - IS_DEFAULT
  and from the corresponding columns in SHOW COLLATION.

  For example:

SELECT COLLATION_NAME, CHARACTER_SET_NAME, ID, IS_DEFAULT
FROM INFORMATION_SCHEMA.COLLATIONS
WHERE COLLATION_NAME LIKE '%uca1400_swedish_as_ci';
+-----------------------+--------------------+------+------------+
| COLLATION_NAME        | CHARACTER_SET_NAME | ID   | IS_DEFAULT |
+-----------------------+--------------------+------+------------+
| uca1400_swedish_as_ci | NULL               | NULL | NULL       |
+-----------------------+--------------------+------+------------+

  The NULL value in these columns now means that the collation
  is applicable to multiple character sets.
  The behavioir of old collations did not change.
  Make sure your client programs can handle NULL values in these columns.

- The structure of the table
  INFORMATION_SCHEMA.COLLATION_CHARACTER_SET_APPLICABILITY was changed.

  Three new NOT NULL columns were added:
  - FULL_COLLATION_NAME
  - ID
  - IS_DEFAULT

  New collations have multiple entries in COLLATION_CHARACTER_SET_APPLICABILITY.
  The column COLLATION_NAME contains the collation name without the character
  set prefix. The column FULL_COLLATION_NAME contains the collation name with
  the character set prefix.

  Old collations have full collation name in both FULL_COLLATION_NAME and
  COLLATION_NAME.

SELECT COLLATION_NAME, FULL_COLLATION_NAME, CHARACTER_SET_NAME, ID, IS_DEFAULT
FROM INFORMATION_SCHEMA.COLLATION_CHARACTER_SET_APPLICABILITY
WHERE FULL_COLLATION_NAME RLIKE '^(utf8mb4|latin1).*swedish.*ci$';
+-----------------------------+-------------------------------------+--------------------+------+------------+
| COLLATION_NAME              | FULL_COLLATION_NAME                 | CHARACTER_SET_NAME | ID   | IS_DEFAULT |
+-----------------------------+-------------------------------------+--------------------+------+------------+
| latin1_swedish_ci           | latin1_swedish_ci                   | latin1             |    8 | Yes        |
| latin1_swedish_nopad_ci     | latin1_swedish_nopad_ci             | latin1             | 1032 |            |
| utf8mb4_swedish_ci          | utf8mb4_swedish_ci                  | utf8mb4            |  232 |            |
| uca1400_swedish_ai_ci       | utf8mb4_uca1400_swedish_ai_ci       | utf8mb4            | 2368 |            |
| uca1400_swedish_as_ci       | utf8mb4_uca1400_swedish_as_ci       | utf8mb4            | 2370 |            |
| uca1400_swedish_nopad_ai_ci | utf8mb4_uca1400_swedish_nopad_ai_ci | utf8mb4            | 2372 |            |
| uca1400_swedish_nopad_as_ci | utf8mb4_uca1400_swedish_nopad_as_ci | utf8mb4            | 2374 |            |
+-----------------------------+-------------------------------------+--------------------+------+------------+

- Other INFORMATION_SCHEMA queries:

  SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS;
  SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.PARAMETERS;
  SELECT TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES;
  SELECT DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA;
  SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.ROUTINES;
  SELECT COLLATION_CONNECTION FROM INFORMATION_SCHEMA.EVENTS;
  SELECT DATABASE_COLLATION FROM INFORMATION_SCHEMA.EVENTS;
  SELECT COLLATION_CONNECTION FROM INFORMATION_SCHEMA.ROUTINES;
  SELECT DATABASE_COLLATION FROM INFORMATION_SCHEMA.ROUTINES;
  SELECT COLLATION_CONNECTION FROM INFORMATION_SCHEMA.TRIGGERS;
  SELECT DATABASE_COLLATION FROM INFORMATION_SCHEMA.TRIGGERS;
  SELECT COLLATION_CONNECTION FROM INFORMATION_SCHEMA.VIEWS;

  display full collation names, including character sets prefix,
  for all collations, including new collations.

  Corresponding SHOW commands also display full collation names
  in collation related columns:

  SHOW CREATE TABLE t1;
  SHOW CREATE DATABASE db1;
  SHOW TABLE STATUS;
  SHOW CREATE FUNCTION f1;
  SHOW CREATE PROCEDURE p1;
  SHOW CREATE EVENT ev1;
  SHOW CREATE TRIGGER tr1;
  SHOW CREATE VIEW;

  These INFORMATION_SCHEMA queries and SHOW statements may change in
  the future, to display show collation names.
2022-08-10 15:04:24 +02:00
Alexander Barkov
6bc10f8026 MDEV-27009 Add UCA-14.0.0 collations - adding version aware implicit weight handling
Implicit weights are now handled according to the Unicode version
(14.0.0 vs earlier versions).

- Adding a new member MY_UCA_INFO::version

- Copy logical positions and the version from "src_uca" to "new_uca"
  in init_weight_level().

- Adding a "const MY_UCA_INFO *" parameter to a few functions
  to know Unicode version to generate implicit weights accordingly:
  - during the collation initialization time, to pages which are
    a mixture of explicit and implicit weights
  - during comparison time, for fully implicit pages
2022-08-10 15:04:11 +02:00
Alexander Barkov
d7ffb7c3dd MDEV-27009 Add UCA-14.0.0 collations - dump logical positions and contractions
- uca-dump can now dump logical positions as a set of "#define" directives.
  Logical positions for 4.0.0 and for 5.2.0 were calculated and put into
  ctype-uca.c manually. That required some efforts by analyzing allkeys.txt
  with help of grep and sort.
  Now when defining a new MY_UCA_INFO it's possible to use the new #define's
  instead of calculating logical positions manually.
  Logical positions also print their weights in DUCET format as a comment
  before the define:

/*
[.0000.0021.0002]
[.0000.0117.0002]
*/

  The comment helps to know weight ranges on various levels,
  which makes it easier to debug the code.

- uca-dump can now dump built-in DUCET contractions

- Adding a new uca-dump command line option --no-contractions, this is useful
  if one needs to re-dump 4.0.0 and 5.2.0 data in ctype-uca.c compatible way.

- Adding a new uca-dump command line options --case-first=upper|level.
  This can be useful if one need to dump with UPPER case first by default.
  It's not yet decided if we'll use --case-first=upper during the dump though.

- Moving parts of the code from the main loop into separate functions
  parse_chars() and parse_weights(). This allows to reuse the code between
  single characters and contractions.

- Adding a new function my_ducet_weight_normalize(), to cut zero weights
  from a weight string, e.g. [AAAA][0000][BBBB] -> [AAAA][BBBB].
  This helps to reuse the code between single characters and contractions.

- Weight normalization is now done before printing, in separate loops inside
  my_ducet_normalize(). Before this change, normalization was done during
  priting, inside the printing loop. This helps to separate steps:
  loading -> normalizing -> printing.
  This makes it easier to follow what's going on, e.g. while debugging.

- Fixing ctype-uca.c to handle built-in contractions of any length.
  Previously we had only built-in contractions in utf8mb4_thai_520_w2,
  which contains only 2-character contractions.
2022-08-10 15:03:58 +02:00
Alexander Barkov
0736c03d56 MDEV-27009 Add UCA-14.0.0 collations - Adding implicit weight handling for Unicode-14.0.0
1. Adding separate functions for different Unicode versions
  - my_uca_520_implicit_weight_primary()
   It calculates implicit weights according to the old algorithm
   that we used to dump Unicode-5.2.0 weights.

  - my_uca_1400_implicit_weight_primary()
    It calculates implicit weights according to
    https://unicode.org/reports/tr10/#Values_For_Base_Table
    as of November 2021, Unicode version 14.0.0.

2. Adding the "@version" line recognition when dumping allkeys.txt.
   Implicit weights are dumped according to @version.

3. Dumping the scanned version as a "#define"

4. Removing dumping MY_UCA_NPAGES, MY_UCA_NCHARS, MY_UCA_CMASK, MY_UCA_PSHIFT,
   as they are defined in ctype-uca.c. Removing dumping of "main()", it's not
   needed. The intent is to generate an *.h file which can be put directly
   to the MariaDB source tree.

5. Adding a structure MY_DUCET. It now contains weights for single
   characters and version related members. Later we'll add contractions
   and logical positions in here.
2022-08-10 15:03:47 +02:00
Alexander Barkov
bb84f61a26 MDEV-27009 Add UCA-14.0.0 collations - adding uca-dump into build targets
- Adding uca-dump into build targets
- Adding ctype-uca.h and moving implicit weight related routines there
- Reusing implicit weight routines in ctype-uca.c and uca-dump.c
- Adding handling of command line arguments to uca-dump
- Fixing some compile-time warnings in uca-dump.c
2022-08-10 15:03:35 +02:00
Sergei Golubchik
45e0373a78 MDEV-28632 Change default of explicit_defaults_for_timestamp to ON 2022-08-10 15:03:22 +02:00
Sergei Golubchik
c38b8f49b8 cleanup: consolidate binlog-related THD::*_used into one bitmap 2022-08-10 15:03:10 +02:00
Sergei Golubchik
4ce1470a70 cleanup: tests
sequence tests verify that one cannot change the structure
of the table. for that they need a valid alter table that
adds an index over an existing column. there's no column 'start'
in the table
2022-08-10 15:02:56 +02:00
Oleksandr Byelkin
1c192843f2 Merge branch '10.9' into 10.10 2022-08-10 14:19:15 +02:00
Oleksandr Byelkin
10ed52767d Merge branch '10.8' into 10.9 2022-08-10 13:57:24 +02:00
Oleksandr Byelkin
6ffbc0e510 Merge branch '10.7' into 10.8 2022-08-10 13:36:20 +02:00
Oleksandr Byelkin
98d7ac1fbe Merge branch '10.6' into 10.7 2022-08-10 13:25:05 +02:00
Addison G
b8f6d315fe MDEV-29222 - Fix mysqld_safe script
The mysqld_safe script was using bad grep options.

The line that was fixed was likely meant to be 2 separate grep commands,
piped into each other, with each one removing any lines that matched.

The `-E` option was unneeded, as the command is not using regex.
2022-08-10 13:24:31 +02:00
Oleksandr Byelkin
65a963f755 Merge branch '10.6' into 10.7 2022-08-10 13:12:32 +02:00
Oleksandr Byelkin
c442e1ae21 Merge branch '10.5' into 10.6 2022-08-10 13:06:08 +02:00
Oleksandr Byelkin
1ac0bce36e Merge branch '10.4' into 10.5 2022-08-10 12:24:31 +02:00
Oleksandr Byelkin
65e8506ca9 Merge branch '10.3' into bb-10.4-release 2022-08-10 12:21:08 +02:00
Nayuta Yanagisawa
faddcf3c39 Do not check symbol returned (or not and so there is some garbadge) by mb_wc() if mb_wc() failed 2022-08-10 11:20:58 +02:00
Sergei Golubchik
122742897b my_safe_process: try to kill the process softly first
first SIGTERM and if the process didn't die in 10 seconds, SIGKILL it.

This allows various tools like `rr`, `gcov`, `gprof`, etc to flush
their data to disk properly
2022-08-10 09:14:17 +02:00
Sergei Golubchik
9ecdf860ce missing ' 2022-08-10 09:14:17 +02:00
Sergei Golubchik
82c07fcabf MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn 2022-08-10 08:54:22 +02:00
Sergei Golubchik
47d0df6ef0 take into account C/C specific CR_ERR_NET_WRITE error 2022-08-10 08:54:22 +02:00
Sergei Golubchik
9d4ed44cac remove invalid options from warning messages
--log-slow-queries was removed in 10.0. Now opt_slow_logname
can be set either with --slow-query-log-file or with --log-basename


--log was removed in 10.0. Now opt_logname
can be set either with --general-log-file or with --log-basename
2022-08-10 08:54:22 +02:00
fluesvamp
50a2a8bb43 Update docs INSTALL BINARY to mention mariadb tar file instead 2022-08-09 19:13:17 +03:00
fluesvamp
f2830af16c Fix typos in the codebase. 2022-08-09 18:41:09 +03:00
Oleksandr Byelkin
d59674be83 Merge branch '10.8' into 10.9 2022-08-09 14:24:40 +02:00
Oleksandr Byelkin
73e086442a Merge branch '10.7' into 10.8 2022-08-09 13:47:17 +02:00
Thirunarayanan Balathandayuthapani
fbfd44be3c MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert()
- Skip the undo logging only for the newly added partition.
2022-08-09 17:09:09 +05:30
Oleksandr Byelkin
15426e5b3d Version maturity fix. 2022-08-09 13:26:57 +02:00
qggcs
195833f1b6 refactor: remove redundant assignments 2022-08-09 12:35:37 +03:00
Oleksandr Byelkin
22d455612b Merge branch '10.8' into 10.9 2022-08-09 09:57:13 +02:00
Oleksandr Byelkin
75d631f333 Merge branch '10.7' into 10.8 2022-08-09 09:52:15 +02:00
Oleksandr Byelkin
47d5cfc650 Merge branch 'bb-10.9-release' into bb-10.10-release 2022-08-09 09:47:48 +02:00
Oleksandr Byelkin
4c18f68d59 Merge branch '10.9' into 10.10 2022-08-09 09:47:16 +02:00
Oleksandr Byelkin
adddde76a1 Merge branch 'bb-10.8-release' into bb-10.9-release 2022-08-09 09:00:00 +02:00
Oleksandr Byelkin
fccbe2bf99 fix tests 2022-08-09 08:59:29 +02:00
Oleksandr Byelkin
564d374704 Merge branch '10.8' into 10.9 2022-08-08 17:17:45 +02:00
Oleksandr Byelkin
50b270525a Merge branch '10.7' into 10.8 2022-08-08 17:15:13 +02:00
Oleksandr Byelkin
1d48041982 Merge branch '10.6' into 10.7 2022-08-08 17:12:32 +02:00
Oleksandr Byelkin
c0fe31c5dd fix of MDEV-12325 patch: symetric changes in sql_yacc_ora 2022-08-08 14:00:21 +02:00
Sergei Golubchik
4f54c219e7 update columnstore
fixes srpm builds on centos7 and other old platforms (with cmake < 3.1)
fixes pre-uninstall script
fixes parallel builds
2022-08-08 13:36:43 +02:00
Monty
4a53253cf9 Fixed that sp-no-valgrind.test is disabled on valgrind builds (not runs) 2022-08-08 11:19:55 +03:00
Monty
a5a9fcdfe4 MDEV-12325 Unexpected data type and truncation when using CTE
When creating a recursive CTE, the column types are taken from the
non recursive part of the CTE (this is according to the SQL standard).

This patch adds code to abort the CTE if the calculated values in the
recursive part does not fit in the fields in the created temporary table.

The new code only affects recursive CTE, so it should not cause any notable
problems for old applications.

Other things:
- Fixed that we get correct row numbers for warnings generated with
  WITH RECURSIVE

Reviewer: Alexander Barkov <bar@mariadb.com>
2022-08-08 11:19:55 +03:00
Alexander Barkov
3ebbfd88a0 MDEV-29159 Patch for MDEV-28918 introduces more inconsistency than it solves, breaks usability
1. Store assignment failures on incompatible data types now raise errors if:
- STRICT_ALL_TABLES or STRICT_TRANS_TABLES sql_mode is used, and
- IGNORE is not used

Otherwise, only a warning is raised and the statement continues.

2. Changing the error/warning test as follows:

-ERROR HY000: Illegal parameter data types inet6 and int for operation 'SET'
+ERROR HY000: Cannot cast 'int' as 'inet6' in assignment of `db`.`t`.`col`

so in case of a big table it's easier to see which column has the problem.
The new error text is also applied to SP variables.
2022-08-05 22:23:40 +04:00
Marko Mäkelä
c980350438 MDEV-13542 fixup: Improve a recovery error message
A message used to say "failed to read or decrypt"
but the "or decrypt" part was removed in
commit 0b47c126e3
without adjusting rarely needed error message suppressions in some
encryption tests.

Let us improve the error message so that it mentions the file name,
and adjust all error message suppressions in tests.

Thanks to Oleksandr Byelkin for noticing one test failure.
2022-08-05 11:02:18 +03:00
Oleksandr Byelkin
5dc8605069 fix tests 2022-08-05 08:48:25 +02:00
Oleksandr Byelkin
ee620a7416 Merge branch '10.5' into 10.6 2022-08-04 16:58:42 +02:00
Sergei Petrunia
3b071bad19 MDEV-29242: Assertion `computed_weight == weight' failed SEL_ARG::verify_weight
Make SEL_ARG::make_root() maintain SEL_ARG::weight.

Also, an unrelated change: fix dbug_print_sel_arg() to correctly
print SQL NULL for the right endpoint.
2022-08-04 17:10:20 +03:00
Oleksandr Byelkin
ea12dafe65 Merge branch '10.4' into 10.5 2022-08-04 12:16:35 +02:00
Oleksandr Byelkin
6adfce9c8d Merge branch '10.3' into 10.4 2022-08-04 12:13:31 +02:00