Skip to content

MDEV-37157 Fix rownum in having clause and subquery #4166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhaoxh16
Copy link

@zhaoxh16 zhaoxh16 commented Jul 4, 2025

  • The Jira issue number for this PR is: MDEV-37157

Description

When rownum used in HAVING without GROUP BY, accepted_rows should be incremented even if the having cond's value is 0.
When rownum used in subquery

  1. Forbid subquery transformed to semi join.
  2. New conditions must be added into having clause when doing in2exists.

Release Notes

Fix bug in rownum function when using in having or subquery

How can this PR be tested?

see new test in main.rownum

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@CLAassistant
Copy link

CLAassistant commented Jul 4, 2025

CLA assistant check
All committers have signed the CLA.

@zhaoxh16 zhaoxh16 marked this pull request as draft July 4, 2025 07:24
@zhaoxh16 zhaoxh16 force-pushed the rownum-in-subquery-fix branch from 9a0b8b9 to 36ccce1 Compare July 4, 2025 07:53
@zhaoxh16 zhaoxh16 changed the title Fix rownum in subquery Fix rownum in having clause and subquery Jul 4, 2025
@zhaoxh16 zhaoxh16 marked this pull request as ready for review July 4, 2025 07:54
@zhaoxh16 zhaoxh16 force-pushed the rownum-in-subquery-fix branch from 36ccce1 to b089d8b Compare July 4, 2025 07:56
@zhaoxh16 zhaoxh16 changed the title Fix rownum in having clause and subquery MDEV-37157 Fix rownum in having clause and subquery Jul 4, 2025
@zhaoxh16 zhaoxh16 force-pushed the rownum-in-subquery-fix branch from b089d8b to dfd2b42 Compare July 4, 2025 08:05
@svoj svoj added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Jul 4, 2025
Description
==========
When rownum used in HAVING without GROUP BY, accepted_rows should be
incremented even if the having cond's value is 0.

When rownum used in subquery
1. Forbid subquery transformed to semi join.
2. New conditions must be added into having clause when doing in2exists.
@zhaoxh16 zhaoxh16 force-pushed the rownum-in-subquery-fix branch from dfd2b42 to b57ee59 Compare July 11, 2025 03:07
@vuvova vuvova requested a review from sanja-byelkin July 11, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.
Development

Successfully merging this pull request may close these issues.

3 participants