<div dir="ltr">I'm trying to add a field to my PostGIS table using the following code:<br><br>--------------------------------------------------------<br>from PyQt4.QtCore import QVariant<br>from qgis.core import *<br><br>inLayer = iface.activeLayer()<br>provider = inLayer.dataProvider()<br><br># add field<br>field = QgsField('test_field', QVariant.String)<br>inLayer.startEditing()<br>provider.addAttributes([field])<br>inLayer.updateFields()<br><br># commit<br>inLayer.commitChanges()<br>--------------------------------------------------------<div><br>The commit fails and the PostGIS log shows an error:<br><br>2015-10-27T08:13:28 1 Erroneous query: ALTER TABLE "received"."env" ADD COLUMN "test_field" returned 7 [ERROR: syntax error at end of input<br><br>LINE 1: ALTER TABLE "received"."env" ADD COLUMN "test_field"<br><br>Seems the call to PostGIS fails to include the column type. Is this a bug, or am I going about this the wrong way?</div></div>