How to refresh the attribute table of a layer after editing the table in the DB-Manager?
Short and sweet:
- Install changeDataSource plugin.
- Right-click on the layer in the Layers Panel and select
Change vector datasource
. - In the dialog box that appears, just hit
OK
without changing any of the settings.
Basically, you are "changing" the vector datasource to what it already was, but this forces QGIS to reload the layer definition.
Tested in QGIS 2.14 on Linux Mint 17.2.
Assuming that your working with a PostGIS database, you can update the statistics of the table of interest by using the ANALYSE
function:
http://www.postgresql.org/docs/current/static/sql-analyze.html
In your case you can execute the statement inside the DB-manager by pressing the button marked in the attached image and executing the ANALYSE
statement in the window, which is also marked. The query would be ANALYSE yourschema.yourtable
.The analyse command should update your table, so that when you access the information again it should reflect the changes you have made.
Do I understand well if you mean to refresh the table in QGIS after a change to the columns is made?
As far as I know, only close and open the project or re-adding the table will make this happen. As long as you saved the default style in the database that might be the fastest way.
When a column is added with the Field Calculator the changes are instantly visible but the DB manager offers more control in defining the field type so I understand why that may not be a solution.