<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi all,<br><br>I have tried many different ways and i am not getting success.<br><br>Lets think that i am inserting rows to table and in table there is column the_geom, my insert sentence has lon and lat,<br>so everytime i insert into table this trigger is fired and it is doing points from lon and lat. In trigger i have now statement that FOR EACH STATEMENT execute...<br>But querys are still too slow (inserting like 200 rows), if i am doing that point upgrading by manually it is very fast. Should be something like the_geom = NEW.the_geom...<br>What i should do ?<br><br><hr id="stopSpelling">From: illurt@hotmail.com<br>To: postgis-users@postgis.refractions.net<br>Subject: RE: [postgis-users] Points and lines<br>Date: Tue, 8 Sep 2009 13:16:35 +0300<br><br>
<style>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass body.EC_hmmessage
{font-size:10pt;font-family:Verdana;}
</style>
Hi,<br><br>Lets think that i am inserting only rows to table, not updating any data.<br>These NEW and OLD pseudos are still helping me ?<br><br>Br.<br>Tuomas<br><br>> Date: Tue, 8 Sep 2009 10:17:58 +0100<br>> From: mark.cave-ayland@siriusit.co.uk<br>> To: postgis-users@postgis.refractions.net<br>> Subject: Re: [postgis-users] Points and lines<br>> <br>> Tuomas Ruohonen wrote:<br>> <br>> > What is wrong in my function, it doesnt stop or should it take so <br>> > loooong... ? Minutes... Trying to insert to lines in table<br>> > <br>> > CREATE OR REPLACE FUNCTION make_point() RETURNS TRIGGER AS $start_point$<br>> > BEGIN<br>> > <br>> > UPDATE positionreports SET the_geom = SetSRID(st_makepoint<br>> > ("longitude","latitude"), 4326);<br>> > <br>> > RETURN NULL; -- result is ignored since this is an AFTER trigger<br>> > END;<br>> > $start_point$ LANGUAGE plpgsql;<br>> > <br>> > CREATE TRIGGER start_point<br>> > AFTER INSERT OR UPDATE ON positionreports<br>> > FOR EACH ROW EXECUTE PROCEDURE make_point();<br>> <br>> Look carefully at your stored procedure - you're updating the contents <br>> of the entire table every time someone modifies a single row.<br>> <br>> Take a look at the documentation here: <br>> http://www.postgresql.org/docs/8.4/interactive/plpgsql-trigger.html. You <br>> should be using the NEW and OLD pseudotypes to change to contents of a <br>> single row.<br>> <br>> <br>> HTH,<br>> <br>> Mark.<br>> <br>> -- <br>> Mark Cave-Ayland - Senior Technical Architect<br>> PostgreSQL - PostGIS<br>> Sirius Corporation plc - control through freedom<br>> http://www.siriusit.co.uk<br>> t: +44 870 608 0063<br>> <br>> Sirius Labs: http://www.siriusit.co.uk/labs<br>> _______________________________________________<br>> postgis-users mailing list<br>> postgis-users@postgis.refractions.net<br>> http://postgis.refractions.net/mailman/listinfo/postgis-users<br><br><hr>Jaa muistosi verkossa haluamiesi henkilöiden kanssa <a href="http://www.microsoft.com/finland/windows/windowslive/products/photos-share.aspx?tab=1">haluamiesi henkilöiden kanssa.</a><br /><hr />Uudessa IE8 selaimessa on uudet pikatoiminnot. <a href='http://www.microsoft.com/finland/windows/products/winfamily/ie/beta/default.mspx' target='_new'>Lataa.</a></body>
</html>