Tuomas, I think you answered your own question. You need a trigger on you your point table that updates your line table. As Mike already mentioned in a separate thread -- check here You need to make a common trigger procedure in (for example) PL/pgSQL that does the update on column X (i.e., NEW.X). See:
http://www.postgresql.org/docs/current/interactive/plpgsql-trigger.html http://www.postgresql.org/docs/current/interactive/triggers.html So a insert/update trigger on point that updates the corresponding line record. Alternatively you could just build a view against your point table that constructs a line as needed and get rid of your line table. You would use the ST_MakeLine aggregate function for that. http://postgis.refractions.net/documentation/manual-svn/ST_MakeLine.html Depending on the size of your dataset and number of points in each line, that could be prohibitively slow. So for example frequently updated point data -- the trigger may be really slow during updates Frequently read data -- the view could be slower -- but you don't pay the trigger penalty. Leo ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Tuomas Ruohonen Sent: Monday, September 07, 2009 6:00 AM To: [email protected] Subject: [postgis-users] Points and lines Hi, I have this kind of problem that i have 2 tables, another has point data and another has line data that comes from points. Everything is okay, i see lines etc. Now I need trigger or function or ... cause everytime that new point comes to table i need to update my lines table also that table shows the latest point in line also. I hope that you understand what i mean :) Tell me different kind of options that I have that I can make this work... Thanks for everybody !! -Tuomas ________________________________ Uusi Spaces ja 25 Gt ilmaista SkyDrive tallennustilaa. Lataa Live paketti. <http://www.download.live.com/> _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
