[postgis-users] Insert geometry into remote database

Francois Hugues hugues.francois at irstea.fr
Mon Dec 10 07:23:12 PST 2012


Hi all,

We need to use our server in production which is postgis 1.5 and we need to automate some operations with another server running postgis 2.0.1 (correction of surface with mnt / slopes)

Here is the error : operator is not unique: text || geometry

I understand it, but don't see how insert a geometry into a remote table with dblink. Any advice ?

Here is the trigger function I'm trying to build :

CREATE OR REPLACE FUNCTION pasto.insert_new_up()
  RETURNS trigger AS
$BODY$

BEGIN

PERFORM DBLINK_EXEC(
'dbname=test host=myhost port=5432 user=me password=pwd',
'INSERT INTO rasters.calcul_surf_up (gid, the_geom, surface) VALUES('||new.gid||', '||new.the_geom||', '||new.surface||')'
);

RETURN NEW;
END;
$BODY$
  LANGUAGE plpgsql 

Hugues.


-- 
Hugues FRANÇOIS 
Ingénieur recherche 

Irstea Grenoble 
2 rue de la papeterie 
38400 Saint-Martin d'Hères 

tel : +33 (0)4.76.76.27.44 
port : +33 (0)6.77.66.21.31 
fax : +33 (0)4.76.51.38.03


More information about the postgis-users mailing list