Skip to content

Instantly share code, notes, and snippets.

@dimaqq
Created April 18, 2017 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimaqq/2f1c725fd7d544f083dd03a47b64abc2 to your computer and use it in GitHub Desktop.
Save dimaqq/2f1c725fd7d544f083dd03a47b64abc2 to your computer and use it in GitHub Desktop.
mysql> describe weather;
+---------+------------+------+-----+---------+-------------------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------+------+-----+---------+-------------------+
| date | char(10) | NO | PRI | NULL | |
| geohash | char(4) | NO | PRI | NULL | |
| weather | json | YES | | NULL | |
| todo | tinyint(4) | YES | MUL | NULL | VIRTUAL GENERATED |
+---------+------------+------+-----+---------+-------------------+
4 rows in set (0.01 sec)
mysql> select * from weather;
+------------+---------+---------+------+
| date | geohash | weather | todo |
+------------+---------+---------+------+
| 2010-10-10 | w21z | NULL | 1 |
+------------+---------+---------+------+
1 row in set (0.00 sec)
mysql> select ST_LatFromGeohash(geohash) from weather;
ERROR 3064 (HY000): Incorrect type for argument geohash in function ST_LATFROMGEOHASH.
mysql> select ST_LatFromGeohash(CAST(geohash as CHAR(4))) from weather;
+---------------------------------------------+
| ST_LatFromGeohash(CAST(geohash as CHAR(4))) |
+---------------------------------------------+
| 1.3 |
+---------------------------------------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment