gdal icon indicating copy to clipboard operation
gdal copied to clipboard

GDALGetOutputDriversForDatasetName: Handle driver name prefixes

Open dbaston opened this issue 1 year ago • 1 comments

Feature description

I would have expected the following to either fail or create a table in the default Postgres database:

ogr2ogr PG av_lv95.gpkg resf

Instead, it creates a directory called PG and a shapefile within that directory. To get the desired behavior I had to do

ogr2ogr "PG:" av_lv95.gpkg resf

I'm not sure what the best behavior is, but I think the first command I tried should either fail, warn on ambiguity, or magically do what I wanted :)

Additional context

No response

dbaston avatar Jun 21 '24 17:06 dbaston

but I think the first command I tried should either fail, warn on ambiguity, or magically do what I wanted :)

I agree that might be surprising, but that's the 'expected' behavior. "PG" is not the recognized prefix of the PostgreSQL driver. It is "PG:". If we'd want to change that, then we shouldn't automatically select shapefile when there's no .dbf/.shp extension in the filename, which might be slightly breaking change

rouault avatar Jun 21 '24 17:06 rouault

Closing this as won't fix / works as intended

rouault avatar Aug 11 '24 16:08 rouault