I have just ran into an issue with QGIS/PostGIS. Here is a summary of my problem:
- I have uploaded a world country boundaries shapefile as a PostGIS table to my database.
- I add the new PostGIS table to QGIS as a layer.
- I toggle editing for the table so that I may edit the file.
- I click on "New Field" and enter "test" as the field name, leaving everything else default.
- I click "OK" and the following error message pops up: "Failed to add field 'test' of type 'int2'. Is the field name unique?"
- There is no other field named "test", and no other field name works.
All the googling I have done on SE/SO and this sub have left me empty handed. Does anyone have an idea as to why I cannot add a field to this PostGIS table?
At first I thought it may have been a privilege issue with Postgres but I double checked the login role that I used has insert/update/delete privileges. Additionally, I connected to the database using the superuser credentials and had the same issue. For reference, I am using QGIS 2.18.9 with Win7 x64.
Also, some additional information: When I toggle editing for the table, the "Delete field" button is still grayed out, which I thought was odd as usually that button is usable when editing is toggled on. Not sure if that's helpful or not.