質問

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:

  1. create your new tables and populate them.

  2. add the additional fields (allow nulls at first until you get your db null-free)

  3. 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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top