PGDump driver issues a CREATE SCHEMA with CREATE_TABLE=OFF
|Reported by:||lpercich||Owned by:||Even Rouault|
When invoked with -append -lco CREATE_TABLE=OFF and -lco SCHEMA=<schema>, ogr2ogr with the PGDump driver generates a CREATE SCHEMA instruction at the begining of the resulting script.
If no schema is specified (assuming "public"), the "CREATE SCHEMA" instruction is not generated.
When invoked with -overwrite -lco CREATE_TABLE=OFF and -lco SCHEMA=<schema>, the PGDump driver generates a CREATE SCHEMA instruction followed by a "drop table schema.table", which always fails in PostgreSQL.
When CREATE_TABLE=OFF (inserting into an existing table), no create schema should be issued.
I'd expect a -lco CREATE_SCHEMA=ON|OFF. Are we sure that a CREATE_TABLE=YES should imply a "CREATE_SCHEMA=YES"? If I need to load many MapInfo tables in Postgres in the same schema with -lco CREATE_TABLE=ON, multiple CREATE SCHEMA instructions are going to fail and we have to remove them by hand (read "by grep|sed").
Also a -lco DROP_TABLE=ON|OFF would be useful, because the PGDump driver cannot guess if the table we're going to create already exists in the destination schema, and Postgres doesn't have a DROP IF EXISTS statement.
(Tested on 1.9dev compiled on Ubuntu 10.04)