I am making relationship between three tables in QGIS 3.8 version ("ACTIVE SITE","FUEL_TANK","REFUEL"). The primary key and the foreign key for the Tables are as follow

  • the primary keys are "ACTIVE SITE"::'SITE_NAME', "FUEL_TANK"::'FUEL_TANK_ID', and "REFUEL"::'REFUEL_ID'
  • the foreign keys are "FUEL_TANK"::'SITE_NAME' and "REFUEL"::'FUEL_TANK_ID'

I made the relationships as seen in the following image

enter image description here

in another word, I've linked the the "ACTIVE SITE" Table and "FUEL_TANK" Table with the foreign key 'SITE_NAME'. And linked the the "FUEL_TANK" Table and "REFUEL" Table with the foreign key 'FUEL_TANK_ID'.

the problem is when I add a new record in "REFUEL" Table the 'FUEL_TANK_ID' takes the 'SITE_NAME' from "FUEL_TANK" Table not the 'FUEL_TANK_ID'

Am I doing something wrong??

And if I had a field in the "REFUEL" Table named 'SITE_NAME' could it be filled automatically from the 'SITE_NAME' field in the "FUEL_TANK" Table?? is there a way to do that??


I've changed the QGIS version from 3.8 to 3.4 and the relation between the tables worked perfectly. I assume that because version 3.8 is not stable yet!!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.