How to disable addition of database name to layer name when adding a vector layer in QGIS?

Just tried this on a sample file geodatabase from ESRI - I see the same thing (except in that case the prefix is "RH_SampleData "). I'm using 2.18.13, GDAL 2.1.3

I don't know of any way to set the layer prefix when you load, but there is a workaround.

In Db Manager SQL queries (using Virtual Layers) you can double-quote table / layer / column names to allow for spaces. This is also useful for when field names match SQL reserved words


select * from "RH_SampleData AADT"

The space does stop the auto-complete from working properly, though. So this is probably no faster or easier than renaming your layers :/

The OpenFileGDB driver seems to be read-only, so renaming your layers should be safe as you won't be able to edit them anyway.

You can use Command Bar Plugin which enables you to rename all layers at once. Using QGIS Command Bar you can write:

rename-layers NYC./

then press enter, and it will remove DB name from all layers at once. Note the dot (.) after NYC because it uses regex and the dot means remove everything including the space.

In the following example, I have a File GDB "RH_SampleData.gdb" and when loading the data into QGIS RH_SampleData was added before every layer. I used QGIS Command Bar and rename-layers command to remove RH_SampleData as you can see in the following gif:

enter image description here