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?


I finally found out why all this. It was because of an old style that was saved in the database and that referred to an older Version of the layer, where some attributes where missing before. In the new Version of the layer all new attributes where added at the end. Overwriting the style using QGIS 2.14 solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.