Skip to content

Conversation

@DaveGosselin-MariaDB
Copy link
Member

@DaveGosselin-MariaDB DaveGosselin-MariaDB commented Sep 30, 2025

…TS Clause

Queries of the form

  SELECT ... FROM (SELECT constant AS alias_N FROM t0) dt ... WHERE EXISTS
    (SELECT ... WHERE (dt.alias_N ...));

must force derived table dt to be materialized, or the WHERE EXISTS will not filter rows correctly. If we allow derived table dt to be merged, then references to dt.alias_N are replaced with their constant values directly, so a WHERE EXISTS subquery will attempt to filter rows from the outer query based on those constant values rather than the columns' values computed during outer query evaluation.

Note that this is a WIP

@DaveGosselin-MariaDB DaveGosselin-MariaDB self-assigned this Sep 30, 2025
@DaveGosselin-MariaDB DaveGosselin-MariaDB force-pushed the 10.11-mdev-35168-null-in-exists-clause branch 2 times, most recently from eee9cb3 to de9a051 Compare October 2, 2025 12:07
…TS Clause

Queries of the form
  SELECT ... FROM (SELECT constant AS alias_N FROM t0) dt ... WHERE EXISTS
    (SELECT ... WHERE (dt.alias_N ...));
must force derived table dt to be materialized, or the WHERE EXISTS will
not filter rows correctly.  If we allow derived table dt to be merged,
then references to dt.alias_N are replaced with their constant values
directly, so a WHERE EXISTS subquery will attempt to filter rows from the
outer query based on those constant values rather than the columns'
values computed during outer query evaluation.
@DaveGosselin-MariaDB DaveGosselin-MariaDB force-pushed the 10.11-mdev-35168-null-in-exists-clause branch from de9a051 to e993f2e Compare October 2, 2025 13:24
Copy link
Member

@spetrunia spetrunia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check out the comments at https://jira.mariadb.org/browse/MDEV-35168.

I've put them there because they are quite general and may be out of scope of this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants