mirror of
https://github.com/jbranchaud/til
synced 2026-01-07 17:18:02 +00:00
Add Assumed Radius Of The Earth as a postgres til
This commit is contained in:
@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
|
|||||||
warrant a full blog post. These are mostly things I learn by pairing with
|
warrant a full blog post. These are mostly things I learn by pairing with
|
||||||
smart people at [Hashrocket](http://hashrocket.com/).
|
smart people at [Hashrocket](http://hashrocket.com/).
|
||||||
|
|
||||||
_422 TILs and counting..._
|
_423 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -174,6 +174,7 @@ _422 TILs and counting..._
|
|||||||
- [Add ON DELETE CASCADE To Foreign Key Constraint](postgres/add-on-delete-cascade-to-foreign-key-constraint.md)
|
- [Add ON DELETE CASCADE To Foreign Key Constraint](postgres/add-on-delete-cascade-to-foreign-key-constraint.md)
|
||||||
- [Adding Composite Uniqueness Constraints](postgres/adding-composite-uniqueness-constraints.md)
|
- [Adding Composite Uniqueness Constraints](postgres/adding-composite-uniqueness-constraints.md)
|
||||||
- [Aggregate A Column Into An Array](postgres/aggregate-a-column-into-an-array.md)
|
- [Aggregate A Column Into An Array](postgres/aggregate-a-column-into-an-array.md)
|
||||||
|
- [Assumed Radius Of The Earth](postgres/assumed-radius-of-the-earth.md)
|
||||||
- [Auto Expanded Display](postgres/auto-expanded-display.md)
|
- [Auto Expanded Display](postgres/auto-expanded-display.md)
|
||||||
- [Change The Current Directory For psql](postgres/change-the-current-directory-for-psql.md)
|
- [Change The Current Directory For psql](postgres/change-the-current-directory-for-psql.md)
|
||||||
- [Checking The Type Of A Value](postgres/checking-the-type-of-a-value.md)
|
- [Checking The Type Of A Value](postgres/checking-the-type-of-a-value.md)
|
||||||
|
|||||||
18
postgres/assumed-radius-of-the-earch.md
Normal file
18
postgres/assumed-radius-of-the-earch.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Assumed Radius Of The Earth
|
||||||
|
|
||||||
|
Using the
|
||||||
|
[`earthdistance`](https://www.postgresql.org/docs/8.3/static/earthdistance.html)
|
||||||
|
module, we can get the assumed radius of the earth (in meters).
|
||||||
|
|
||||||
|
```sql
|
||||||
|
> create extension cube;
|
||||||
|
CREATE EXTENSION
|
||||||
|
|
||||||
|
> create extension earthdistance;
|
||||||
|
CREATE EXTENSION
|
||||||
|
|
||||||
|
> select earth();
|
||||||
|
earth
|
||||||
|
---------
|
||||||
|
6378168
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user