[postgis-users] Link beween the_geom of 2 tables

Paragon Corporation lr at pcorp.us
Fri Aug 2 14:39:14 PDT 2013


Try using a  trigger.  
http://www.postgresql.org/docs/9.1/static/sql-createtrigger.html
 
A foreign key won't work since it requires a btree primary key unless you
use a btree primarky key on geometry, which at best would only work for
points.
 
Hope that helps,
Regina
http://www.postgis.us
http://www.paragoncorporpation.com
 

  _____  

From: postgis-users-bounces at lists.osgeo.org
[mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of BladeOfLight16
Sent: Thursday, August 01, 2013 5:19 PM
To: Melin Maxence; PostGIS Users Discussion
Subject: Re: [postgis-users] Link beween the_geom of 2 tables


On Thu, Jul 18, 2013 at 11:15 AM, Melin Maxence <maxencemelin at yahoo.fr>
wrote: 

Do you know if it is possible to have in the_geom field of one record in a
table A, a link (query, hypertext, something else...) to the_geom field of
another record in a different table (table B), so that when the geom is
modified in the record of the table A, it is automatically modified in the
related record of the table B ?


It sounds like you need foreign
<http://www.postgresql.org/docs/9.2/static/tutorial-fk.html> keys. You can
then obtain the geometry using a JOIN as Rich mentioned. Whether A should
reference B or vice versa or it's appropriate to have a separate table would
depend on the particular situation. That said, this is only the case if the
geometries in the table are supposed to be identical. If what you're really
after is to clip a geometry or something of that nature, I imagine a
topology might be more suited to your needs, but you could potentially
accomplish such modification with triggers as Rich mentioned.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130802/b9932b36/attachment.html>


More information about the postgis-users mailing list