mariadb/mysql-test/suite
Igor Babaev 4d38267fc7 MDEV-29307 Wrong result when joining two derived tables over the same view
This bug could affect queries containing a join of derived tables over
grouping views such that one of the derived tables contains a window
function while another uses view V with dependent subquery DSQ containing
a set function aggregated outside of the subquery in the view V. The
subquery also refers to the fields from the group clause of the view.Due to
this bug execution of such queries could produce wrong result sets.

When the fix_fields() method performs context analysis of a set function AF
first, at the very beginning the function Item_sum::init_sum_func_check()
is called. The function copies the pointer to the embedding set function,
if any, stored in THD::LEX::in_sum_func into the corresponding field of the
set function AF simultaneously changing the value of THD::LEX::in_sum_func
to point to AF. When at the very end of the fix_fields() method the function
Item_sum::check_sum_func() is called it is supposed to restore the value
of THD::LEX::in_sum_func to point to the embedding set function. And in
fact Item_sum::check_sum_func() did it, but only for regular set functions,
not for those used in window functions. As a result after the context
analysis of AF had finished THD::LEX::in_sum_func still pointed to AF.
It confused the further context analysis. In particular it led to wrong
resolution of Item_outer_ref objects in the fix_inner_refs() function.
This wrong resolution forced reading the values of grouping fields referred
in DSQ not from the temporary table used for aggregation from which they
were supposed to be read, but from the table used as the source table for
aggregation.

This patch guarantees that the value of THD::LEX::in_sum_func is properly
restored after the call of fix_fields() for any set function.
2024-06-04 17:54:01 -07:00
..
archive MDEV-33727 mariadb-dump trusts the server and does not validate the data 2024-05-06 17:16:10 +02:00
binlog MDEV-9179 When binlog_annotate_row_events on , event of binlog file is truncated 2024-05-06 20:14:37 +02:00
binlog_encryption MDEV-9179 When binlog_annotate_row_events on , event of binlog file is truncated 2024-05-06 20:14:37 +02:00
client
compat MDEV-33727 mariadb-dump trusts the server and does not validate the data 2024-05-06 17:16:10 +02:00
csv Backporting bugs fixes fixed by MDEV-31340 from 11.5 2024-05-21 14:58:01 +04:00
encryption MDEV-29307 Wrong result when joining two derived tables over the same view 2024-06-04 17:54:01 -07:00
engines Merge 10.4 into 10.5 2024-02-12 11:38:13 +02:00
federated MDEV-33727 mariadb-dump trusts the server and does not validate the data 2024-05-06 17:16:10 +02:00
funcs_1 MDEV-34295 CAST(char_col AS DOUBLE) prints redundant spaces in a warning 2024-06-04 15:34:14 +04:00
funcs_2
galera MDEV-33952: Fix flaky galera_create_table_as_select test with debug sync 2024-06-03 09:48:13 +02:00
galera_3nodes MDEV-32633: Fix Galera cluster <-> native replication interaction 2024-06-03 09:48:13 +02:00
galera_3nodes_sr MDEV-34071: Failure during the galera_3nodes_sr.GCF-336 test 2024-05-06 03:16:59 +02:00
galera_sr MDEV-16944 fix galera tests 2024-04-23 10:55:35 +02:00
gcol fix tests after 349ca2be74 2024-05-08 20:01:17 +02:00
handler
heap
innodb MDEV-34222 Alter operation on redundant table aborts the server 2024-05-24 15:48:19 +05:30
innodb_fts MDEV-16944 Fix file sharing issues on Windows in mysqltest 2024-04-17 16:52:37 +02:00
innodb_gis MDEV-16944 Fix file sharing issues on Windows in mysqltest 2024-04-17 16:52:37 +02:00
innodb_i_s
innodb_zip MDEV-16944 Fix file sharing issues on Windows in mysqltest 2024-04-17 16:52:37 +02:00
jp
json MDEV-19487: JSON_TYPE doesnt detect the type of String Values 2024-04-29 22:32:17 +05:30
large_tests MDEV-16944 Fix file sharing issues on Windows in mysqltest 2024-04-17 16:52:37 +02:00
maria MDEV-34055 Assertion '...' failure or corruption errors upon REPAIR on Aria tables 2024-05-07 19:24:02 +03:00
mariabackup MDEV-34053 mariadbbackup privilege REPLICA MONITOR issue 2024-05-09 09:53:44 +10:00
mtr/t
mtr2
multi_source Merge from 10.4 to 10.5 2024-04-15 17:46:49 +02:00
optimizer_unfixed_bugs
parts MDEV-24610 MEMORY SE: check overflow in info calls with HA_STATUS_AUTO 2024-05-22 09:18:09 +10:00
perfschema sporadic failure of perfschema.func_file_io 2024-05-05 21:37:07 +02:00
perfschema_stress
period MDEV-25370 Update for portion changes autoincrement key in bi-temp table 2024-01-31 16:03:38 +01:00
plugins Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
roles MDEV-33727 mariadb-dump trusts the server and does not validate the data 2024-05-06 17:16:10 +02:00
rpl sporadic failures of rpl.rpl_parallel_sbm 2024-05-05 21:37:07 +02:00
s3 MDEV-33727 update test results 2024-05-08 20:01:17 +02:00
sql_sequence MDEV-33727 mariadb-dump trusts the server and does not validate the data 2024-05-06 17:16:10 +02:00
storage_engine
stress
sys_vars MDEV-28366 GLOBAL debug_dbug setting affected by collation_connection=utf16... 2024-04-10 06:09:45 +04:00
unit
vcol MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt 2024-04-29 11:08:07 +04:00
versioning Merge 10.4 into 10.5 2024-02-13 14:25:21 +02:00
wsrep Merge 10.4 into 10.5 2023-12-21 11:30:32 +02:00