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] fix delete limit error #2413

Closed
wants to merge 4 commits into from

Conversation

Aias00
Copy link
Contributor

@Aias00 Aias00 commented Jul 30, 2024

What's changed?

fix delete limit error

2024-07-30 14:57:01 [jpa-metrics-cleaner-0] ERROR org.apache.hertzbeat.warehouse.store.history.jpa.JpaDatabaseDataStorage - expiredDataCleaner database error: Exception [EclipseLink-4002] (Eclipse Persistence Services - 4.0.2.v202306161219): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':delNum' at line 1
Error Code: 1064
Call: delete from hzb_history limit :delNum
Query: DataModifyQuery(sql="delete from hzb_history limit :delNum").

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.

@pwallk
Copy link
Contributor

pwallk commented Jul 30, 2024

Similar pr #2329

@tomsun28
Copy link
Contributor

hi @Aias00 , how about this similar pr #2329
@pwallk describe

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).

@Aias00
Copy link
Contributor Author

Aias00 commented Jul 31, 2024

hi @Aias00 , how about this similar pr #2329 @pwallk describe

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).

yes, i made a mistake, postgresql truly not support this delete limit statement. @pwallk was right, i will close this pr 😂

@Aias00 Aias00 closed this Jul 31, 2024
@Aias00 Aias00 deleted the bugfix/fix_delete_limit_error branch July 31, 2024 14:41
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.

3 participants