You don't have to do anything for that. Just use
ST_MakePoint and cast.
INSERT that looks like this,
-- looks like this.
INSERT INTO foo (geom) VALUES
The default SRID for
geography is 4326. If you're new, I would suggest using
geography instead of
ALTER TABLE foo drop column geom,
ADD COLUMN geog geography(point,4326);
For that, just use a cast to geography or allow the implicit cast.
Implicit cast and srid
Explicit cast, implicit srid
Explicit cast and srid
ST_SetSRID( ST_MakePoint(3,4), 4326 )::geography
Which looks like this,
INSERT INTO foo (geog) VALUES
-- implicit cast and SRID
( ST_MakePoint(1,2) ),
-- explicit cast, implicit SRID
( ST_MakePoint(1,2)::geography ),
-- explicit cast and SRID
( ST_SetSRID( ST_MakePoint(3,4), 4326 )::geography );
Converting to text and then forcing PostgreSQL to parse the text with
ST_GeogFromText is silly and slow.