Details
-
Bug
-
Status: In Review (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
Can result in hang or crash
-
Correlated subqueries causing incorrect results and crashes
Description
We have a general problem with relationship attribute data relating to Items representing subselects, particularly when these subselects are correlated to upper level selects via the use of outer references. How these attributes change during the various phases of execution, i.e.
{prepare, optimize, execute}within each of
{conventional, stored procedure, prepared statement, 1st execution, subsequent execution}is inconsistent.
In this series of commits
1 & 2) trivial changes to restrict building of lists not needed during certain operations.
3) MDEV-30073. Igor's commit dealing with Items that need to survive between executions being allocated in statement memory.
4 & 5) some fix-ups and suggestions from Monty.
6) MDEV-32294. Code directly "inspired" by mysql's collapsing structures during query merges.
7) MDEV-35673 during the development of main.outer_reference MTR file, a number of problems were encountered with correlated subselects. Searching outstanding issues revealed a number of similar problems. This patch deals with most of those issues by
- Correcting the used table map for subquery/expressions which is currently, at times, incorrect. This involves allocating some items on statement memory, building and managing a list of items resolved in inner subqueries, and altering how table maps are accumulated in expressions.
- Extending the structures updated when queries are merged, an extension of MDEV-32294 but this code is unrelated to mysql.
- Avoiding un-needed processing during (re-)fixing items, solving many crashes. We have enough information gathered during the first fix_fields call to avoid calling fix_outer_field during any subsequent fix_fields call.
Attachments
Issue Links
- blocks
-
MDEV-30756 Crash in get_sort_by_table / make_join_statistics / update_depend_map_for_order, various UBSAN pointer issues
-
- Stalled
-
-
MDEV-31269 Various SIGSEGV crashes, UBSAN issues and memory corruption on 2nd PS execution caused by exists-to-in
-
- Stalled
-
-
MDEV-32297 Failing queries with outer references to views in degenerated selects
-
- Stalled
-
-
MDEV-35277 SIGSEGV and UBSAN null-pointer-use in get_sort_by_table on SELECT...EXISTS
-
- Stalled
-
-
MDEV-35565 Server crashes simplifying group by <subquery>
-
- Stalled
-
- includes
-
MDEV-35676 Wrong result on 2nd execution with outer reference
-
- Open
-
- is blocked by
-
MDEV-30073 Wrong result on 2nd execution of PS for query with NOT EXISTS
-
- In Review
-
-
MDEV-32294 fix_fields() problem with inconsistent outer context paths
-
- Stalled
-
- relates to
-
MDEV-31270 Wrong result on 2nd execution for PS with NULL on MAX function and IN predicate
-
- Open
-
-
MDEV-37448 MariaDB Server Crashes Calling Stored Procedure
-
- Confirmed
-
-
MDEV-6054 ER_BAD_FIELD_ERROR (Unknown column in where clause) on the 2nd execution of PS
-
- Stalled
-
-
MDEV-26944 Server crash on selecting some data from information_schema
-
- Stalled
-
-
MDEV-30756 Crash in get_sort_by_table / make_join_statistics / update_depend_map_for_order, various UBSAN pointer issues
-
- Stalled
-
-
MDEV-31937 Server crash on 2nd execution query SELECT from view of prepare statement if query has impossible HAVING
-
- Open
-
-
MDEV-32702 Assertion Failed at /mariadb-11.3.0/sql/item.cc:5807
-
- Confirmed
-
-
MDEV-32766 Segmentation fault at /mariadb-11.3.0/sql/sql_select.cc:23373
-
- Confirmed
-