1

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)'

enter image description here

https://dbfiddle.uk/?rdbms=postgres_14&fiddle=1cd06e002ab74b70189f908cafb7e17b

carl.hiass
  • 1,526
  • 1
  • 6
  • 26

1 Answers1

3

geometry and geography are geographic data types from the extension PostGIS and point is a PostgreSQL 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 and it is very easy to use.

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.

Jim Jones
  • 18,404
  • 3
  • 35
  • 44