Creating Virtual layer that is the centroid of another polygon layer

It is ok to have multiple geometries in a table, but you would have to tell QGIS which one to use when creating the virtual layer.

Since virtual layers are always recomputed (each time you pan or zoom the map), modifications in the source layer will be shown.

To get the field list, you can export the layer style file, open it with a text editor, and copy-paste the fields name.

enter image description here


You could switch the order in your select statement.

SELECT ST_CENTROID(geometry), b.*
FROM "building" AS b