[gdal-dev] GPKG to PG single transaction, different schemas

Matteo Ghetta matteo.ghetta at gmail.com
Tue May 14 08:30:43 PDT 2024


Hi all,

I've a geopackage with many layers (in the following example let's 
pretend just 2) that I want to import in a single transaction 
(important!) into a PG database.

GPKG and PG table names are the same, but it can happen that the tables 
are in different schemas. I couldn't find the correct flags combination 
to specify the destination schema.table_name.

With the following command features of first_table are appended to the
second_table table:

ogr2ogr --debug ON -f PostgreSQL "PG:host=localhost user=matteo 
password=my_pws dbname=test" -append /home/matteo/export_db.gpkg 
first_schema.first_layer second_schema.second_layer

same with the -nln option:

ogr2ogr --debug ON -f PostgreSQL "PG:host=localhost user=matteo 
password=my_pws dbname=test" -append /home/matteo/export_db.gpkg 
first_layer -nln first_schema.first_layer second_layer -nln 
second_schema.second_layer

Should I specify a vrt catalog or am I missing some options?

Cheers and thanks!

Matteo



More information about the gdal-dev mailing list