Depending on the table I'm working on, the geometry column does not always have the same name, for example in my data it is called sometimes
"geom", or even
"geometrie". How can I get the name of this attribute in QGIS?
A bit late but I Had the same problem when defining a dynamic query for a virtual layer and stumbled over this discussion.
My solution was the understanding, that in QGis queries/expressions the "geometry"/"$geometry"-pseudo-SQL-keyword allows the access to any vector-geometry-souce without knowing the name of that column, even if there is no physical column, think about shape-file-Layers.