I'm working in a PostgreSQL table (PostGIS) that I loaded into QGIS. This layer has been created by a SQL Statement in pgAdmin.
I noticed that the order of attributes shown in the attribute table differs from that I declared with the SQL Statement. But checking the layer properties in QGIS (tab "fields"), the order is correct.
To make it more weird, I tested it with QGIS 2.14, 2.18 and 3.6 and the wrong order in the attribute table doesn't occur in 2.14, but in the others.
Does anyone have an idea why order changes?