Skip to content
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

Query box limits number of queries executed at once resulting in broken transaction (part of it being added instead of full rollback) #19091

Closed
fliespl opened this issue Apr 2, 2024 · 2 comments · Fixed by #19101
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Milestone

Comments

@fliespl
Copy link
Contributor

fliespl commented Apr 2, 2024

Describe the bug

As in the title, if we provide the box with a multiy query as below:

start transaction;
60+ insert queries;
1 bad query;
commit;

All items within first 50 queries will be added to database even though transaction would eventually rollback (due to 1 bad query at the end).

I have pinpointed it to this part of code:
https://ss.codeone.pl/ss-2024-04-02-13-31-47-1712057507-2QWM4C6S.png

if ($run_query && $executed_queries < 50) {

To Reproduce

start transaction;
60+ insert queries;
1 bad query i.e. delete from non_existant_table limit 1;
commit;

Expected behavior

Proper transaction handling or information about too many queries.

Screenshots

If applicable, add screenshots to help explain the bug.

Server configuration

  • Operating system: Debian 12
  • Web server: nginx
  • Database version: mariadb 10.11
  • PHP version: 8.3
  • phpMyAdmin version: 5.2.1

Client configuration

  • Browser: Chrome
  • Operating system: Windows 11

Additional context

None

@williamdes
Copy link
Member

Thank you for the debug !
@kamil-tekiela could you please help me with this one ?

@williamdes williamdes added Bug A problem or regression with an existing feature affects/5.2 This issue or pull-request affects 5.2.x releases (and maybe further versions) affects/6.0 This issue or pull-request affects 6.0.x releases (and maybe further versions) confirmed/5.2 This issue is confirmed to be reproduced on 5.2 at the time this label was set confirmed/6.0 This issue is confirmed to be reproduced on 6.0 at the time this label was set labels Apr 6, 2024
@kamil-tekiela
Copy link
Contributor

I had a quick look at it and I reproduced the bug on master branch. What happens is that the code is designed to execute every query sequentially until the end. If any of the queries fails, we only execute one more after that and then stop. So if the commit is the one after the broken SQL then it will execute. If there's anything else in between them then the commit will never happen.

It seems like a bug to me, but I will investigate more to see why the code is designed in such way.

@MauricioFauth MauricioFauth self-assigned this Apr 30, 2024
@MauricioFauth MauricioFauth added this to the 5.2.2 milestone Apr 30, 2024
@williamdes williamdes added has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete and removed affects/5.2 This issue or pull-request affects 5.2.x releases (and maybe further versions) affects/6.0 This issue or pull-request affects 6.0.x releases (and maybe further versions) confirmed/5.2 This issue is confirmed to be reproduced on 5.2 at the time this label was set confirmed/6.0 This issue is confirmed to be reproduced on 6.0 at the time this label was set labels Apr 30, 2024
@williamdes williamdes linked a pull request Apr 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants