mariadb/mysql-test/suite
Rex 7d46ee3336 MDEV-35673 Item_subselect::used_tables_cache issues with outer references and optimization.
This split from MDEV-32294, discovered when inspecting how
Item_subselect::used_tables_cache gets recalculated during 1st and 2nd
executions of prepared statements.

We build a list of outer references resolved against each select_lex.
This list is not reset at the end of a prepared statement, so each
element in this must be allocated on statement memory. Because of this
we rely on MDEV-30073, as prior to this patch, some outer references are
freed at the end of prepared statement execution.  We use this list to
recalculate Item_subselect::used_tables_cache

There are a number of additional processing steps that need to happen
during query merges.  A derived table merge will leave a mix of
SELECT_LEX::nest_base_level pointers in our query structure.  Some
Item::*processors will search for items that 'belong' only to the 'unit'
being searched.  We need to update this and nest_level when merging.

We update SELECT_LEX::outer_references_resolved_here, in case an Item in
a subquery is no longer an outer reference.

We introduce a number tests in main.outer_reference, along with a way of
wrapping each select to be executed in a number of different ways.
TODO, check that the result of each of these different ways of execution
is identical.  We could wrap this into client/mysqltest and perhaps
allow stacking of each execution method, such as --view (to create a
view from our test statement and then select from the view) and --ps (to
prepare our test statement, now selecting from a view, and compare data
output from first and second executions).

Name resolution fixes related to prepared statement execution.

We no longer call fix_outer_field after the first execution, we now
rely on the attribute depended_from, populated during the first execution.
Code is added to Item_field::fix_fields to compensate.

We allocate view field substituions on statement memory.  When run as a
prepared statement, this happens during the first execution.

table_map fixes related to prepared statement and view processing.

In setup_fields, during the 2nd execution of a prepared statement, we
can call used_tables() prior to any caches being set up.  This can
result in incorrect processing.

We also ban execution of EXPLAIN EXTENDED statements during mtr ps
protocol runs as the generation of warnings varies due to the fact that
some Item select_transformers cannot be run during execution of the
prepare statement, so we would normally expect a different warning
output.
2025-06-05 18:11:31 +11:00
..
archive Merge branch '10.6' into '10.11' 2025-04-16 03:34:40 +02:00
atomic Merge branch '10.6' into 10.11 2025-04-26 10:47:03 +02:00
binlog MDEV-35694: Mysqlbinlog --stop-position should warn if EOF not reached with --read-from-remote-server 2025-04-21 14:21:55 -06:00
binlog_encryption Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
client
compat MDEV-35673 Item_subselect::used_tables_cache issues with outer references and optimization. 2025-06-05 18:11:31 +11:00
csv
encryption Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
engines MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error) 2025-03-17 18:11:51 +07:00
federated MDEV-30073 Wrong result on 2nd execution of PS for query with NOT EXISTS 2025-06-04 05:27:47 +11:00
funcs_1 MDEV-35810 fix test results 2025-01-14 14:01:28 +01:00
funcs_2 Merge 10.5 into 10.6 2025-03-26 17:09:57 +02:00
galera Merge 10.6 into 10.11 2025-05-26 08:10:47 +03:00
galera_3nodes Merge 10.6 into 10.11 2025-05-26 08:10:47 +03:00
galera_3nodes_sr galera mtr tests: synchronization between branches and editions 2025-04-02 04:50:11 +02:00
galera_sr Merge branch '10.6' into '10.11' 2025-04-02 06:33:39 +02:00
gcol Merge branch '10.6' into 10.11 2025-04-21 11:23:11 +02:00
handler Merge branch '10.5' into 10.6 2024-12-17 11:06:09 +11:00
heap Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
innodb MDEV-36868: Inconsistency when shrinking innodb_buffer_pool_size 2025-05-28 13:33:06 +03:00
innodb_fts Merge 10.6 into 10.11 2025-03-28 10:55:40 +02:00
innodb_gis Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
innodb_i_s
innodb_zip Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
jp
json MDEV-35614: JSON_UNQUOTE doesn't work with emojis 2025-04-19 08:55:05 +10:00
large_tests
maria Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
mariabackup MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM 2025-03-31 17:57:35 +02:00
mtr/t Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
mtr2
multi_source MDEV-36238 Functional Tests for --master-info-file and --show-slave-auth-info 2025-03-18 18:17:02 -06:00
optimizer_unfixed_bugs
parts Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
perfschema Merge 10.6 into 10.11 2025-02-10 14:45:18 +02:00
perfschema_stress
period Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
plugins Merge branch '10.6' into 10.11 2025-04-21 11:23:11 +02:00
roles Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
rpl MDEV-36663: Testcase Fixup 2025-05-13 12:27:41 +03:00
s3 Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
sql_sequence MDEV-36032 Check whether a table can be a sequence when ALTERed with SEQUENCE=1 2025-04-29 16:28:01 +10:00
storage_engine
stress MDEV-34453 Trying to read 16384 bytes at 70368744161280 outside the bounds of the file: ./ibdata1 2024-09-20 20:26:43 +05:30
sys_vars Merge 10.6 into 10.11 2025-05-26 08:10:47 +03:00
sysschema
unit
vcol Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
versioning MDEV-33370 Assertion `!is_set() || (m_status == DA_OK_BULK && 2025-06-03 11:27:45 +03:00
wsrep Merge branch '10.5' into '10.6' 2025-04-02 04:43:24 +02:00