diff --git a/.travis.yml b/.travis.yml index 7727843028..74b1c58dcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,8 +45,8 @@ jobs: postgresql: '11' apt: packages: - - postgresql-11-postgis-2.5 - - postgresql-11-postgis-2.5-scripts + - postgresql-11-postgis-3 + - postgresql-11-postgis-3-scripts env: POSTGRES_MAJOR_VERSION=11 PARSE_SERVER_TEST_DB=postgres before_install: bash scripts/before_install_postgres.sh before_script: bash scripts/before_script_postgres.sh diff --git a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js index 31602afc0d..a3f34dc50b 100644 --- a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js +++ b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js @@ -621,11 +621,11 @@ const buildWhereClause = ({ const distance = fieldValue.$maxDistance; const distanceInKM = distance * 6371 * 1000; patterns.push( - `ST_distance_sphere($${index}:name::geometry, POINT($${index + + `ST_DistanceSphere($${index}:name::geometry, POINT($${index + 1}, $${index + 2})::geometry) <= $${index + 3}` ); sorts.push( - `ST_distance_sphere($${index}:name::geometry, POINT($${index + + `ST_DistanceSphere($${index}:name::geometry, POINT($${index + 1}, $${index + 2})::geometry) ASC` ); values.push(fieldName, point.longitude, point.latitude, distanceInKM); @@ -673,7 +673,7 @@ const buildWhereClause = ({ } const distanceInKM = distance * 6371 * 1000; patterns.push( - `ST_distance_sphere($${index}:name::geometry, POINT($${index + + `ST_DistanceSphere($${index}:name::geometry, POINT($${index + 1}, $${index + 2})::geometry) <= $${index + 3}` ); values.push(fieldName, point.longitude, point.latitude, distanceInKM);