I 'm running postgis with qgis 2.6. I created a database and tables that i need to update with new datas provided with shapes. I cannot find how to insert them in table. All attributes both shapes and table are same. I don't despair to have an "easy" way instead of using an insert to command that i'm not sure to use correctly in postgis command. I've tried the database manager but i only succeed in erasing all previous data in the table >_<

Window 7 64 bits Qgis2.6 Postgis1.5 Postgrsql 9.4

3 Answers 3


I's quite easy to copy-paste features from one layer to another. You start editing the PostGIS layer, then choose the new shape layer in the layer table of contents, os it's "active". Now use the select tool to select the features from the shape layer. And click the "Copy" button on the editing toolbar.

Now re-select the PostGIS layer in the table of contents, and click the "Paste" button from the editing toolbar. And save edits. Voila.

  • 2
    FYI for future readers - if you need to copy attributes with the geometry, the field name in the shape layer needs to match the field name in the PostGIS table. Commented Oct 17, 2018 at 16:07

You could try something like:

INSERT INTO table_name VALUES ( 1234, 'object_name', GeometryFromText ( 'POINT ( 10 20 )', -1 ) );

And if you have too many shapes to insert manually, then just create a new table with the new data and merge the two tables together.

--> Merging tables in PostGIS

  • Thanks for the help, I make it work as you said, creating new tables and using SQL command :INSERT INTO table_name ( Attributs_1,attributs_2,...attributs_N) SELECT attribut_A, attribut_B,.... FROM table_name_2. Thx again
    – Obi Wan
    Commented Jan 15, 2015 at 15:12

If your aim is just to append data from shapefiles as is into an existing table I would use the GDAL ogr2ogr tool http://www.gdal.org/ogr2ogr.html with -update and -append options. Read also the driver page http://www.gdal.org/drv_pg.html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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