<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<STYLE>P {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
BODY {
FONT-SIZE: 10pt; FONT-FAMILY: Tahoma
}
</STYLE>
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=391260212-15082007>Couple of things.
One you are using GeometryFromText incorrectly and 2 your code is just
wrong. Not just missing froms. I think below should work although I
haven't tested it.</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=391260212-15082007></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=391260212-15082007>Try instead</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=391260212-15082007></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=391260212-15082007>CREATE OR REPLACE
FUNCTION update_links() RETURNS "trigger"<BR> AS
<BR>$BODY$<BR>BEGIN<BR> UPDATE links SET the_geom =
MakeLine(NEW.the_geom,ends.the_geom)
<BR> FROM nodes As
ends<BR> WHERE NEW.name =
links.from_node and ends.name = links.to_node;</SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=391260212-15082007> UPDATE
links SET the_geom = MakeLine(starts.the_geom,NEW.the_geom)
<BR> FROM nodes As
starts<BR> WHERE starts.name =
links.from_node and NEW.name = links.to_node;</SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=391260212-15082007>RETURN
NEW;<BR>END<BR>$BODY$<BR> LANGUAGE plpgsql;<BR>CREATE TRIGGER
update_links_update<BR> AFTER UPDATE<BR> ON nodes<BR> FOR EACH
ROW<BR> EXECUTE PROCEDURE update_links();</SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<B>From:</B> postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Broun
Uganda<BR><B>Sent:</B> Wednesday, August 15, 2007 5:28 AM<BR><B>To:</B>
postgis-users@postgis.refractions.net<BR><B>Subject:</B> [postgis-users] RE:
Trigger updata lines<BR><BR></DIV>
<DIV></DIV><BR>Sorry the error i get is:<BR> <BR><PRE style="BORDER-RIGHT: 0pt; BORDER-TOP: 0pt; BORDER-LEFT: 0pt; BORDER-BOTTOM: 0pt">Query failed: ERROR: missing FROM-clause entry for table "nodes" ....</PRE><BR>Broun
Uganda<BR><BR><BR><BR>
<BLOCKQUOTE>
<HR id=EC_stopSpelling>
From: tekuganda@hotmail.com<BR>To:
postgis-users@postgis.refractions.net<BR>Subject: Trigger updata
lines<BR>Date: Tue, 14 Aug 2007 23:24:44 +0300<BR><BR>
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>
..ExternalClass P
{padding:0px;}
..ExternalClass
{font-size:10pt;font-family:Tahoma;}
</STYLE>
<BR>I want to create a trigger that updates lines' geometry depending on the
position of 2 points (from_node & to_node). If i move a point
connecting two or more lines, the ends of lines should also move and follow
the point. I wrote the following trigger but it gives me error that am giving
multiple geometry.<BR> <BR>CREATE OR REPLACE FUNCTION update_links()
RETURNS "trigger"<BR> AS <BR>'<BR>DECLARE<BR>starts
character varying;<BR>ends character varying;<BR>BEGIN<BR>starts = NEW.name
WHERE nodes.name = links.from_node;<BR>ends = NEW.name WHERE nodes.name =
links.to_node;<BR>UPDATE links SET the_geom = GeometryFromtext(starts.<FONT
face="">the_geom</FONT>,ends.the_geom) ;<BR>RETURN
NEW;<BR>END'<BR> LANGUAGE plpgsql;<BR>CREATE TRIGGER
update_links_update<BR> AFTER UPDATE<BR> ON nodes<BR> FOR
EACH ROW<BR> EXECUTE PROCEDURE
update_links();<BR> <BR> <BR>Thanks for your help<BR><BR><BR>
<HR>
Live Earth is coming. Learn more about the hottest summer event - only
on MSN. <A href="http://liveearth.msn.com/?source=msntaglineliveearthwlm"
target=_blank>Check it out!</A> </BLOCKQUOTE><BR>
<HR>
Hotmail to go? Get your Hotmail, news, sports and much more! <A
href="http://mobile.msn.com" target=_new>Check out the New MSN Mobile</A>
</BODY></HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>