You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using a near search WITH _sort=near and WITH offset search a SQLGrammarException is thrown. This is caused by a bug in the SearchQueryBuilder of the com.healthmarketscience.sqlbuilder package.
"HAPI-1262: org.hibernate.exception.SQLGrammarException: JDBC exception executing SQL [SELECT t1.RES_ID,(ABS((t0.SP_LATITUDE - ?)) + ABS((t0.SP_LONGITUDE - ?))) AS MHD0 FROM HFJ_RESOURCE t1 INNER JOIN HFJ_SPIDX_COORDS t0 ON (t1.RES_ID = t0.RES_ID) WHERE ((t0.HASH_IDENTITY = ?) AND (((t0.SP_LATITUDE >= ?) AND (t0.SP_LATITUDE <= ?)) AND ((t0.SP_LONGITUDE >= ?) AND (t0.SP_LONGITUDE <= ?)))) GROUP BY t1.RES_ID ORDER BY MHD0 offset ? rows fetch next ? rows only] [ERROR: column \"t0.sp_latitude\" must appear in the GROUP BY clause or be used in an aggregate function\n Position: 24] [n/a]"
Expected behavior
All resources are returned in the correct order, no exception is thrown.
Actual behaviour
PostgreSQL rejects the query because t0.SP_LATITUDE and t0.SP_LONGITUDE are neither included in the GROUP BY clause nor used in an aggregate function.
Environment (please complete the following information):
HAPI FHIR 7.6.0
The text was updated successfully, but these errors were encountered:
Describe the bug
When using a near search WITH
_sort=near
and WITH offset search a SQLGrammarException is thrown. This is caused by a bug in the SearchQueryBuilder of the com.healthmarketscience.sqlbuilder package.To Reproduce
Steps to reproduce the behavior:
Start a hapi(jpastarter) server and search: http://localhost:8080/fhir/Location?near=50.097%7C8.6648%7C1000&_sort=near&_count=1&_offset=1
"HAPI-1262: org.hibernate.exception.SQLGrammarException: JDBC exception executing SQL [SELECT t1.RES_ID,(ABS((t0.SP_LATITUDE - ?)) + ABS((t0.SP_LONGITUDE - ?))) AS MHD0 FROM HFJ_RESOURCE t1 INNER JOIN HFJ_SPIDX_COORDS t0 ON (t1.RES_ID = t0.RES_ID) WHERE ((t0.HASH_IDENTITY = ?) AND (((t0.SP_LATITUDE >= ?) AND (t0.SP_LATITUDE <= ?)) AND ((t0.SP_LONGITUDE >= ?) AND (t0.SP_LONGITUDE <= ?)))) GROUP BY t1.RES_ID ORDER BY MHD0 offset ? rows fetch next ? rows only] [ERROR: column \"t0.sp_latitude\" must appear in the GROUP BY clause or be used in an aggregate function\n Position: 24] [n/a]"
Expected behavior
All resources are returned in the correct order, no exception is thrown.
Actual behaviour
PostgreSQL rejects the query because t0.SP_LATITUDE and t0.SP_LONGITUDE are neither included in the GROUP BY clause nor used in an aggregate function.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: