wultra / powerauth-push-server

PowerAuth Push Server repository
Apache License 2.0
24 stars 12 forks source link

SQL against push_inbox table failes in SQLServer #853

Closed korbelm closed 21 hours ago

korbelm commented 1 week ago

Environment: PAC: 1.8.0 SNAPSHOT TestServer: 1.7.0 MSSQL 2022 (docker version)

Call: POST /powerauth-cloud/v2/inbox/messages

app-1  | 2024-06-24T15:46:09.491Z ERROR 156 --- [powerauth-java-server] [nio-8080-exec-2] [d3cba5e5a81d9ac2a36449bfcdf9dc3f-9b3e7d8bd355f9ce] i.g.p.e.DefaultExceptionHandler          : could not execute statement [Incorrect syntax near the keyword 'read'.] [insert into push_inbox (body,inbox_id,read,subject,summary,timestamp_created,timestamp_read,type,user_id,id) values (?,?,?,?,?,?,?,?,?,?)]; SQL [insert into push_inbox (body,inbox_id,read,subject,summary,timestamp_created,timestamp_read,type,user_id,id) values (?,?,?,?,?,?,?,?,?,?)]
app-1  |
app-1  | org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement [Incorrect syntax near the keyword 'read'.] [insert into push_inbox (body,inbox_id,read,subject,summary,timestamp_created,timestamp_read,type,user_id,id) values (?,?,?,?,?,?,?,?,?,?)]; SQL [insert into push_inbox (body,inbox_id,read,subject,summary,timestamp_created,timestamp_read,type,user_id,id) values (?,?,?,?,?,?,?,?,?,?)]
romanstrobl commented 2 days ago

We will need to rename columns read and type, they are reserved keywords in MSSQL. I was looking for a generic escaping solution in JPA but it does not seem to exist, so renaming the columns will make sure that we do not need to use database specific code.