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

[bugfix] fixed jpa expired data clean error #2329

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

pwallk
Copy link
Contributor

@pwallk pwallk commented Jul 21, 2024

What's changed?

fixed #2310

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

@Query(value = "delete from hzb_history limit :delNum", nativeQuery = true)
@Query(value = "DELETE FROM hzb_history WHERE id IN ( SELECT t2.id from (SELECT t1.id FROM hzb_history t1 LIMIT ?1) as t2)", nativeQuery = true)
Copy link
Contributor

Choose a reason for hiding this comment

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

hi, can you describe the reason change? The limit xx is avaiable in postgresql and mysql.

@pwallk pwallk mentioned this pull request Jul 30, 2024
4 tasks
@pwallk
Copy link
Contributor Author

pwallk commented Jul 31, 2024

First, the delNum argument cannot be passed correctly and should be changed instead:delete from hzb_history limit ?1,secondly postgresql does not support delete followed by limit,Therefore, it should be deleted with nested subqueries (earlier MySQL versions did not support nested subqueries, such as 5.7, 5.6, so two layers of nesting are used).

@pwallk
Copy link
Contributor Author

pwallk commented Jul 31, 2024

This is version 1.6 that I deployed on the server:
Clip_2024-07-22_08-53-12
postgresql throws an exception when the argument can be passed correctly:
Clip_2024-07-22_09-05-50

@pwallk
Copy link
Contributor Author

pwallk commented Jul 31, 2024

sorry my review is pending
Clip_2024-07-31_09-54-53

Copy link
Contributor

@tomsun28 tomsun28 left a comment

Choose a reason for hiding this comment

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

lgtm 👍👍

@tomsun28 tomsun28 merged commit 51b1a9b into apache:master Aug 1, 2024
3 checks passed
@pwallk pwallk deleted the bug-jpa-history-clean branch August 22, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

[BUG] jpa expired data clean error
2 participants