I have a table on my PostgreSQL database that I would like to update by inserting the missing lines that I have in many other shapefile tables. I was able to connect to my server PostgreSQL from the Windows' shell (psql -h localhost -U quest -d "test" -p 5432
) and import some shapefiles to update my table (to insert the data from pgAdmin), but instead of importing all my tables into PostgreSQL, I would like to update my table directly from the shell. The problem is that I do not know how to go about it. Specifically, I don't know how to tell PostgreSQL the source of my tables in the "from".
In pgAdmin I use :
INSERT INTO bal.bal (bal_pk_uid, bal_agg_id, geom)
SELECT bal_pk_uid, bal_agg_id, geom
FROM bal.bal_2 bal2
WHERE bal2.bal_pk_uid is not null and not exists (select 1 from bal.bal balglobale where balglobale.bal_pk_uid = bal2.bal_pk_uid);
but in the shell how am I supposed to tell the path to my source "C:"CARTO"\bal.shp bal2"?