0

I am trying to figure out how to use this GDAL driver to create a SQL dump, using the ogr2ogr commandline. I have tried the following:

ogr2ogr -oo AUTOCORRECT_INVALID_DATA=YES --config PG_USE_COPY=YES -f PGDump /vsizip/BAGNLDL-08122020/9999STA08122020.zip

This runs without errors. However, it creates a folder called 'PGDump' containing shapefiles, whereas I expected it to create a single SQL file. Upon adding the extra argument 'test.sql' (after the example of this driver) I get:

ogr2ogr -oo AUTOCORRECT_INVALID_DATA=YES --config PG_USE_COPY=YES -f PGDump test.sql /vsizip/BAGNLDL-08122020/9999STA08122020.zip

But then I receive the following error:

FAILURE: Unable to open datasource `test.sql' with the following drivers.

I've found different usage of quotation marks online, but adjusting them (e.g. "PGDump" instead of PGDump) does not change any of the results above. I'm running GDAL version 3.2.1.

Is there anything wrong with the syntax, or am I just misunderstanding how to use ogr2ogr?

  • Use -f PGDump name_of_the_dump. The first version should actually give an error as well because -f PGDump defines only format, but shapefile or directory of shapefiles is the default output for ogr2ogr and that obviously leads to wrong operation. – user30184 Jan 7 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.