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

GuestbookResponseServiceBean: PSQLException: ERROR: trailing junk after numeric literal at or near "3a" #10232

Closed
pdurbin opened this issue Jan 12, 2024 · 0 comments · Fixed by #10233
Labels
Type: Bug a defect
Milestone

Comments

@pdurbin
Copy link
Member

pdurbin commented Jan 12, 2024

I'm on 39794d5 on develop (post 6.1) and I can easily reproduce on my laptop a problem with an SQL query in GuestbookResponseServiceBean.

jakarta.servlet.ServletException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 4.0.1.payara-p1.v202304041433): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: trailing junk after numeric literal at or near "3a"
  Position: 69
Error Code: 0
Call: select count(o.id) from GuestbookResponse  o  where o.dataset_id  = 3and eventtype != 'AccessRequest'
Query: DataReadQuery(sql="select count(o.id) from GuestbookResponse  o  where o.dataset_id  = 3and eventtype != 'AccessRequest'")

Steps to reproduce:

  • Create a dataset via API. I've been using mvn test -Dtest=FilesIT#testAddTinyFile.
  • Log in and look for the draft
  • Click on the draft
  • BOOM, the error above

Screenshots:
Screenshot 2024-01-12 at 12 23 36 PM
Screenshot 2024-01-12 at 12 23 41 PM

Here's the fix we need (an extra space on line 931:

- query = em.createNativeQuery("select count(o.id) from GuestbookResponse o where o.dataset_id = " + datasetId+ "and eventtype != '" + GuestbookResponse.ACCESS_REQUEST +"'");
+ query = em.createNativeQuery("select count(o.id) from GuestbookResponse o where o.dataset_id = " + datasetId+ " and eventtype != '" + GuestbookResponse.ACCESS_REQUEST +"'");

I thought I'd be able to reproduce the problem on https://beta.dataverse.org which is running the same commit, but I can't seem to. I'm using Docker locally but it shouldn't matter. The SQL statment definitely needs a space. In my example, dataset id 3 is being glommed onto and as 3and.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug a defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant