Hello,

 

I'm not sure to understand well your problems but it seems you have sql 
questions rather than postgis ones... For the first one, I don't really 
understand what you are looking for but I think what you want to add is 
constraint called foreign key (you will find useful information in the postgres 
documentation). For your second questions, you may achieve that using a trigger 
function but you have to be aware that it will not work if you have a not null 
or a primary key constraint (except if you have a serial type, a sequence, or 
any other rule in your trigger function to fill this column automatically)

 

Hugues.

 

 

De : [email protected] 
[mailto:[email protected]] De la part de Alessio Degioannini
Envoyé : samedi 6 décembre 2014 13:32
À : postgis-users
Objet : [postgis-users] Help CONSTRAINTS and others questions

 

Hi,
I'm a postgis/postgres newbie and I I would like to get some help on the topics 
that I'm going to describe.



I have imported into the database the shapefile "survey" of points (trees). The 
spatial table "survey" contains five columns:
- "Gid" (created during import and primary key, integer)
- "Id"
- "Code"
- "Old number"
- "Geom" (it also created during import).

The database includes several tables ("Species", "Defects", "Disease" and 
others) related to the main table "VTA".
Now I would like to know why, unlike what happened to the other tables, I can 
not connect with "ADD CONSTRAINT" column "code" (integer, not null, unique) of 
the table "VTA" to the corresponding column "code" (also integer, not null) the 
spatial table "survey".

Another question: when I'm editing a field (for example "species name" in the 
column "species" of table "VTA", related to the table "Species", would that 
"species name" could be completed on the basis of the records in the table 
"Species". How can I do this?
Thanks in advance.

Alessio








 
_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Reply via email to