Bug report #20031

The only layer contained in a singlelayer GPKG / SQLite / FileGDB is incorrectly added to the map without "|layername=" in some circumstances

Added by Andrea Giudiceandrea over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:Even Rouault
Category:Data Provider/OGR
Affected QGIS version:3.3(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27853

Description

When there is only 1 layer in a GPKG / SQLite / FileGDB container file and you drag and drop the file in the map or you use the Data Source Manager / Vector dialog window to add the layer to the map, then the layer is automatically (without the "Select Vector Layers to Add..." dialog window appearing) added only with an incorrect source like

filepath\filename.gpkg

instead of a more correct

filepath\filename.gpkg|layername=name_of_the_layer

This could lead to annoying layers mixing ups / shuffling (see the already fixed #18081 and #19885).

On the contrary, when the layer in a single layer gpkg/sqlite/filegdb container is added to the map through the Browser panel instead, its source is in the correct form "filepath\filename.gpkg|layername=name_of_the_layer".

Originally reported in #19938#note-6


Related issues

Related to QGIS Application - Bug report #18081: GDB recognition mixup Closed 2018-02-12
Related to QGIS Application - Bug report #19885: Using the Browser panel layers are added by layerid Closed 2018-09-18

Associated revisions

Revision 119cd8ac
Added by Even Rouault over 5 years ago

QgisApp::addVectorLayer(): add |layername= to OGR datasets (fixes #20031)

Do it also in case of datasets that have a single layer, in case they might
later be edited to have more layers
(except for a few drivers known to be always single layer)

History

#1 Updated by Andrea Giudiceandrea over 5 years ago

#2 Updated by Andrea Giudiceandrea over 5 years ago

  • Related to Bug report #19885: Using the Browser panel layers are added by layerid added

#3 Updated by Even Rouault over 5 years ago

  • Assignee set to Even Rouault

#4 Updated by Even Rouault over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF