Why does one of the following notations print a readable string, (100,200)
whereas the others show a binary format?
SELECT geography 'POINT(100 200)',
point '100,200',
geography(point) 'POINT(100 200)'
https://dbfiddle.uk/?rdbms=postgres_14&fiddle=1cd06e002ab74b70189f908cafb7e17b
CodePudding user response:
geometry
and geography
are geographic data types from the extension PostGIS and point
is a PosgreSQL geometric
data type. If you're planing to store latitude and longitude values I suggest you to use PostGIS, as it provides plenty of handy functions out of the box.
The binary value you're seeing is a WKB (well known binary) representation of the geometry - standard representation. There are many other ways
to serialize geometries.