-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Support casting between PostGIS geometry and geography types in where expressions (close #1983)
#2495
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
Conversation
|
Deploy preview for hasura-docs ready! Built with commit a7e6d5c |
|
Review app for commit 00b846d deployed to Heroku: https://hge-ci-pull-2495.herokuapp.com |
|
Review app for commit 534a40a deployed to Heroku: https://hge-ci-pull-2495.herokuapp.com |
|
Review app for commit 1f48fba deployed to Heroku: https://hge-ci-pull-2495.herokuapp.com |
|
Review app for commit ea348a0 deployed to Heroku: https://hge-ci-pull-2495.herokuapp.com |
ea348a0 to
0c90e2b
Compare
|
Review app for commit 0c90e2b deployed to Heroku: https://hge-ci-pull-2495.herokuapp.com |
|
Review app for commit f65db63 deployed to Heroku: https://hge-ci-pull-2495.herokuapp.com |
f65db63 to
71f46df
Compare
|
Review app for commit 71f46df deployed to Heroku: https://hge-ci-pull-2495.herokuapp.com |
|
Review app for commit a7e6d5c deployed to Heroku: https://hge-ci-pull-2495.herokuapp.com |
|
Review app https://hge-ci-pull-2495.herokuapp.com is deleted |
|
Beep boop! 🤖 Awesome work @lexi-lambda! All of us at Hasura ❤️ what you did. Thanks again 🤗 |
…e` expressions (close hasura#1983) (hasura#2495) * server: Bump dependencies to allow Haddock to run successfully * Support casting between PostGIS geometry and geography types in filters
Description
This adds a new
_castoperator to boolean comparison expressions for fields of typegeometryandgeography. This allows queries to take advantage of both the more efficient and featureful operations ongeometryand the more accurate distance calculations ofgeography, regardless of how the data is actually stored. The following syntax is used for queries that use casts:{ geom_table(where: { geom_col: { _cast: { geography: { _st_d_within: { distance: 1000000 from: { type: "Point", coordinates: [1, 50] } } } } } }){ name } }Affected components
Related Issues
#1983
Solution and Design
This particular approach hardwires casts between geometry and geography types into the schema generation, but that isn’t strictly necessary, and the actual SQL generation supports arbitrary casts.
I explored a little what it would involve to use the
pg_caststable to generate casts, and it isn’t that hard, but I’m not sure if it’s useful for anything other than this particular use case, so this just bakes those casts in for now.Steps to test and verify
Limitations, known bugs & workarounds