Whenever I run a query on project layers that should return a geometry column such as
select 1 as id, st_union(geometry) as geometry from layer
the column containing the geometry simply doesn't show up. This is annoying since I can't load the results as virtual layers anymore. Using spatial functions that don't return a geometry object such as st_area do work though. This only affects Virtual Layers in the DB-Manager no matter the data source (json,gpkg..). QGIS Versions used: 3.20.2, uninstalled then 3.20.3 on Win 10.
Could it be some setting I am overlooking or is there a easy solution?
Update 1: The problem appears also in the LTR-version 3.16.11 using the installer that uses 'OSGeo4W v2' but it does not appear in the same LTR-version that uses the old OSGeo4W.
Update 2: The problem still persists in any qgis version that depends on OSGeo4W v2 Tried on different windows 10 machines (1609, 1809 and 21H1) Please push this issue on the QGIS bug tracker.
Update 3: Issue still persists in 3.22.3. A feasible workaround is posted here. Update 4 Issue still persists in 3.24 RC