1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-08 17:02:21 +03:00
Commit Graph

8012 Commits

Author SHA1 Message Date
c7fe8e51de Merge 10.11 into 11.0 2023-04-17 16:50:01 +03:00
656c2e18b1 Merge 10.10 into 10.11 2023-04-14 13:08:28 +03:00
a009280e60 Merge 10.9 into 10.10 2023-04-14 12:24:14 +03:00
44281b88f3 Merge 10.8 into 10.9 2023-04-14 11:32:36 +03:00
1d1e0ab2cc Merge 10.6 into 10.8 2023-04-12 15:50:08 +03:00
5bada1246d Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
ac5a534a4c Merge remote-tracking branch '10.4' into 10.5 2023-03-31 21:32:41 +02:00
f33fc2fae5 MDEV-30539 EXPLAIN EXTENDED: no message with queries for DML statements
EXPLAIN EXTENDED for an UPDATE/DELETE/INSERT/REPLACE statement did not
produce the warning containing the text representation of the query
obtained after the optimization phase. Such warning was produced for
SELECT statements, but not for DML statements.
The patch fixes this defect of EXPLAIN EXTENDED for DML statements.
2023-03-25 12:36:59 -07:00
3a9358a410 MDEV-28883 Re-design the upper level of handling UPDATE and DELETE statements
This patch introduces a new way of handling UPDATE and DELETE commands at
the top level after the parsing phase. This new way of processing update
and delete statements can be seen in the implementation of the  prepare()
and execute() methods from the new Sql_cmd_dml class. This class derived
from the Sql_cmd class can be considered as an interface class for processing
such commands as SELECT, INSERT, UPDATE, DELETE and other comands
manipulating data in tables.
With this patch processing of update and delete statements after parsing
proceeds by the following schema:
  - precheck of the access rights is performed for the used tables
  - the used tables are opened
  - context analysis phase is performed for the statement
  - the used tables are locked
  - the statement is optimized and executed
  - clean-up is performed for the statement
The implementation of the method Sql_cmd_dml::execute() adheres this schema.
The virtual functions of the class Sql_cmd_dml used for precheck of the
access rights, context analysis, optimization and execution allow to adjust
this schema for processing data manipulation statements of any types.

This schema of processing data manipulation statements is taken from the
current MySQL code. Moreover the definition the class Sql_cmd_dml introduced
in this patch is almost a full replica of such class in the existing MySQL.
However the implementation of the derived classes for update and delete
statements is quite different. This implementation employs the JOIN class
for all kinds of update and delete statements. It allows to perform main
bulk of context analysis actions by the function JOIN::prepare(). This
guarantees that characteristics and properties of the statement tree
discovered for optimization phase when doing context analysis are the same
for single-table and multi-table updates and deletes.

With this patch the following functions are gone:
  mysql_prepare_update(), mysql_multi_update_prepare(),
  mysql_update(), mysql_multi_update(),
  mysql_prepare_delete(), mysql_multi_delete_prepare(), mysql_delete().
The code within these functions have been used as much as possible though.
The functions mysql_test_update() and mysql_test_delete() are also not
needed anymore. The method Sql_cmd_dml::prepare() serves processing
  - update/delete statement
  - PREPARE stmt FROM "<update/delete statement>"
  - EXECUTE stmt when stmt is prepared from update/delete statement.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2023-03-15 17:35:22 -07:00
eb441f6cb7 Fixed wrong DBUG_PRINT 2023-03-02 13:11:54 +02:00
a777a8a6a3 KILL USER and missing privileges
note that `KILL USER foo` should *not* fail with ER_KILL_DENIED_ERROR
when SHOW PROCESSLIST doesn't show connections of that user.
Because no connections exist or because the caller has no PROCESS -
doesn't matter.

also, fix the error message to make sense
("You are not owner of thread <current connection id>" is ridiculous)
2023-02-21 23:22:56 +01:00
2e431ff7e6 Merge 10.11 into 11.0 2023-02-16 13:34:45 +02:00
1fd0099839 Merge 10.10 into 10.11 2023-02-16 11:41:18 +02:00
345356b868 Merge 10.9 into 10.10 2023-02-16 11:36:38 +02:00
0d55914d96 Merge 10.8 into 10.9 2023-02-16 10:25:34 +02:00
dbab3e8d90 Merge 10.6 into 10.8 2023-02-10 13:43:53 +02:00
6aec87544c Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
c41c79650a Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
762fe015c1 MDEV-30558: ER_KILL_{,QUERY_}DENIED_ERROR - normalize id type
The error string from ER_KILL_QUERY_DENIED_ERROR took a different
type to ER_KILL_DENIED_ERROR for the thread id. This shows
up in differences on 32 big endian arches like powerpc (Deb notation).

Normalize the passing of the THD->id to its real type of my_thread_id,
and cast to (long long) on output. As such normalize the
ER_KILL_QUERY_DENIED_ERROR to that convention too.

Note for upwards merge, convert the type to %lld on new translations
of ER_KILL_QUERY_DENIED_ERROR.
2023-02-07 19:28:18 +11:00
33fc8037e0 Fixed some issues with FORCE INDEX
Added code to support that force index can be used to force an index scan
instead of a full table scan. Currently this code is disable but I added
a test to verify that things works if the code is ever enabled.

Other things:

- FORCE INDEX will now work with "Range checked for each record" and
  join cache (see main/type_time_6065)
- Removed code ifdef with BAD_OPTIMIZATION (New cost calculations should
  fix this).
- Removed TABLE_LIST->force_index and comment that it should be removed
- Added TABLE->force_index_join and use in the corresponding places.
  This means that FORCE INDEX FOR ORDER BY will not affect keys used
  in joins anymore.
  Remove TODO that the above should be added.
  I still kept TABLE->force_index as it's used in
  test_if_cheaper_ordering() and opt_range.cc
- Removed setting table->force_index when calling test_quick_select() as
  it's not needed (force_index is an argument to test_quick_select())
2023-02-02 23:12:46 +03:00
c7c415734d Merge branch '10.10' into 10.11 2023-01-31 11:07:08 +01:00
76bcea3154 Merge branch '10.9' into 10.10 2023-01-31 11:01:48 +01:00
de2d089942 Merge branch '10.8' into 10.9 2023-01-31 10:37:31 +01:00
b923b80cfd Merge branch '10.6' into 10.7 2023-01-31 09:33:58 +01:00
c3a5cf2b5b Merge branch '10.5' into 10.6 2023-01-31 09:31:42 +01:00
a977054ee0 Merge branch '10.3' into 10.4 2023-01-28 18:22:55 +01:00
7fa02f5c0b Merge branch '10.4' into 10.5 2023-01-27 13:54:14 +01:00
dd24fa3063 Merge branch '10.3' into 10.4 2023-01-26 10:34:26 +01:00
ea270178b0 MDEV-30052 Crash with a query containing nested WINDOW clauses
Use SELECT_LEX to save lists for ORDER BY and GROUP BY before parsing
WINDOW clauses / specifications. This is needed for proper parsing
of a nested WINDOW clause when a WINDOW clause is used in a subquery
contained in another WINDOW clause.

Fix assignment of empty SQL_I_List to another one (in case of empty list
next shoud point on first).
2023-01-20 09:07:02 +01:00
284ac6f2b7 MDEV-27653 long uniques don't work with unicode collations 2023-01-19 20:33:03 +04:00
3a237f7666 Merge 10.10 into 10.11 2023-01-11 11:13:56 +02:00
cae5a0328b Merge 10.9 into 10.10 2023-01-10 15:06:25 +02:00
820ebcec86 Merge 10.8 into 10.9 2023-01-10 14:50:58 +02:00
8356fb68c3 Merge 10.6 into 10.7 2023-01-04 14:52:25 +02:00
e441c32a0b Merge 10.5 into 10.6 2023-01-03 18:13:11 +02:00
8b9b4ab3f5 Merge 10.4 into 10.5 2023-01-03 17:08:42 +02:00
fb0808c450 Merge 10.3 into 10.4 2023-01-03 16:10:02 +02:00
ca23558a05 --skip-name-resolve=0 didn't work
custom code in `case OPT_SKIP_RESOLVE`
was overriding the correct value from handle_options().
2023-01-02 00:04:03 +01:00
5e3c948cc9 MDEV-29852 SIGSEGV in mysql_create_routine or is_acl_user on 2nd execution, ASAN use-after-poison in get_current_user (sql_acl.cc)
if lex->definer is replaced, take care to restore it at the
end of PS EXECUTE
2022-12-24 16:13:50 +01:00
f97f6955bd Merge 10.3 into 10.4 2022-12-14 06:20:04 +02:00
697dbd15e0 MDEV-21187: log_slow_filter="" logs queries not using indexes
Consistent with MDEV-4206 and empty log_slow_filter still means
no explict filtering. Since 21518ab2e4 however the
log_queries_not_using_indexes became stored in the same variable.

As we need to test for the absense of log_queries_not_using_indexes
the SERVER_QUERY_NO_INDEX USED part of log_slow_statement, the empty
criteria resulted in an always true to log queries not using indexes if
log_slow_filter was set to empty.

Adjusted the log_slow.test for MDEV-4206 as slow_log_query has been
global and session for a while and it was relying on the MDEV-21187
buggy behavior to detect a slow query.

Reviewer: Monty
2022-12-14 10:15:32 +11:00
64071d30bd Merge 10.10 into 10.11 2022-12-07 10:00:52 +02:00
3ff4eb07ed Merge 10.9 into 10.10 2022-12-07 09:49:38 +02:00
23f705f3a2 Merge 10.8 into 10.9 2022-12-07 09:43:38 +02:00
9e27e53dfa Merge 10.6 into 10.7 2022-12-07 09:39:46 +02:00
e55397a46d Merge 10.5 into 10.6 2022-12-05 18:04:23 +02:00
4eb8e51c26 Merge 10.4 into 10.5 2022-11-30 13:10:52 +02:00
c2fc5266ad MDEV-29880 Galera test failure on GCF-336
Fix `wsrep_table_accessible_when_detached()` so that commands that
access no tables are rejected while a node is disconnected from a
cluster.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2022-11-29 07:02:35 +02:00
ad937cf33a Merge branch '10.10' into 10.11 2022-11-02 13:08:01 +01:00
0537ce4e9f remove LEX_USER->is_public
it's now redundant
2022-11-02 00:31:27 +01:00