Set country and subdivision based on zip

Let me put an example where there are several entries for the same zip. I just found that 39450 is one example in the spanish database:

# select * from country_zip where zip = '39450';
  id   |          city          | country |        create_date         | create_uid | subdivision | write_date | write_uid |  zip  
-------+------------------------+---------+----------------------------+------------+-------------+------------+-----------+-------
 21899 | Arenas De Iguña        |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21900 | Arenas De Iguña        |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21901 | San Cristobal          |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21902 | San Cristobal          |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21903 | Pedredo                |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21904 | Pedredo                |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21905 | San Vicente De Leon    |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21906 | San Vicente De Leon    |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21907 | Serna, La (Iguña)      |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21908 | Serna, La (Iguña)      |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21909 | Cohiño                 |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21910 | Cohiño                 |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21911 | Santa Agueda           |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21912 | Santa Agueda           |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21913 | Las Fraguas            |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21914 | Las Fraguas            |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21915 | Santa Cruz De Iguña    |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21916 | Santa Cruz De Iguña    |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21917 | Los Llares             |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450
 21918 | Los Llares             |      70 | 2020-07-16 16:22:20.183929 |          1 |        1190 |            |           | 39450
 21919 | Palacio (Arenas Iguña) |      70 | 2020-07-16 16:22:20.183929 |          1 |        1150 |            |           | 39450

So in all the cases the country is 70 (Spain) and the subdivision is 1150 (Cantabria Autonomous Comunity) and 1190 (Cantabria Province).

So the system could also guees the correct Country and the correct Subdivision while keeping the autocompletion on the city to pick the right one.