I am having an DB in POSTGIS which is having following fields like Country,State,District,taluk . Each fields are interlinked with one other by means of ID . Now I want to add new fields (say: Sub_locality & Locality) by creating unique ID and Append it in the old DB How can I do in PostGIS ?any Suggestions? Thanks in advance.
This is a pretty conceptual question so I don't know that code can be given in the answer. But basically you have a number of steps:
create your new tables and populate them.
add the additional fields (allow nulls at first until you get your db null-free)
Populate the additional fields (update foo set bar_id = (select id from bar where ....)
)
Check for nulls. Then once you are done, alter the tables to have not null constraints. If you need an interrim check you can add a CHECK
constraint that id is below a certain point or the foreign key is not null.