GEOMETRY Data Type - SQL Server to PostgreSQL Migration

SQL Server and PostgreSQL provide the GEOMETRY data type to store spatial data. Note that you have to enable the PostGIS extension to use the GEOMETRY data type in PostgreSQL.

PostgreSQL:

  -- Enable PostGIS
  CREATE EXTENSION IF NOT EXISTS postgis;

SQL Server and PostgreSQL:

  -- Sample table 
  CREATE TABLE geo 
  (
     geodata GEOMETRY
  );
 
  -- Inserting sample value
  INSERT INTO geo VALUES ('POLYGON ((-72 -21, -70 -18, -69 -17, -72 -21))');

For more information, see SQL Server to PostgreSQL Migration.