I am in the process of populating a PostGIS database from a bunch of shapefiles loaded in a QGIS project. The field names of the shapefiles don't match those in the database so it is not possible to use the built-in loader. So I was trying to use an INSERT query in the DB Manager to do so. However, it seems that the DB manager has either a DB scope or a virtual layer scope, and it does not seem possible to copy from a project file to a database table by mapping the field names to each other.
I used a query that goes along this form:
INSERT INTO public.table (field1, field2, geom) SELECT field_one, field_two, geometry FROM project_layer
Is there a workaround that allows using a SQL query in the DB manager to INSERT features from a project layer into a PostGIS table?