hasura / hasura/graphql-engine

Postgis 3 error: LWGEOM_dwithin: Operation on mixed SRID geometries (Point, 0) != (Point, 4326)

Open
#7,665 2 comments 0 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.1.0-beta.1

### Environment

Docker on Mac m1

### What is the expected behaviour?

Query worked before upgrading to postgis 3:

```graphql
{
restaurant(where: {location: {_st_d_within: {distance: 0.47406, from: {type: "Point", coordinates: [-122.44123, 37.75479]}}}}) {
name
}
}

```

### What is the current behaviour?

Produces this error:

```
{
"errors": [
{
"extensions": {
"internal": {
"statement": "SELECT coalesce(json_agg(\"root\" ), '[]' ) AS \"root\" FROM (SELECT row_to_json((SELECT \"_1_e\" FROM (SELECT \"_0_root.base\".\"name\" AS \"name\" ) AS \"_1_e\" ) ) AS \"root\" FROM (SELECT * FROM \"public\".\"restaurant\" WHERE ((ST_DWithin(\"public\".\"restaurant\".\"location\", (ST_GeomFromGeoJSON($3 ))::geometry, ($2)::real ))) ) AS \"_0_root.base\" ) AS \"_2_root\" ",
"prepared": true,
"error": {
"exec_status": "FatalError",
"hint": null,
"message": "LWGEOM_dwithin: Operation on mixed SRID geometries (Point, 0) != (Point, 4326)",
"status_code": "XX000",
"description": null
},
"arguments": [
"(Oid 114,Just (\"{\\\"x-hasura-role\\\":\\\"admin\\\"}\",Binary))",
"(Oid 700,Just (\">\\242\\183\\254\",Binary))",
"(Oid 25,Just (\"{\\\"coordinates\\\":[-122.44123,37.75479],\\\"type\\\":\\\"Point\\\"}\",Binary))"
]
},
"path": "$",
"code": "unexpected"
},
"message": "database query error"
}
]
}
```

### How to reproduce the issue?

1. Postgres 12 + Postgis 3.0.3 + Hasura 2.1.0-beta.1
2. Insert restaurant rows with `type: Point` like below
3. Run query above

image

### Any possible solutions?

I found this in searching and it looks the same, but was supposedly fixed.

https://github.com/hasura/graphql-engine/issues/3415

### If the bug is confirmed, would you be willing to submit a PR?

Likely not

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.