One of my postgis tables tables automatically includes the nextval(xxx) in the edit feature form in qgis(and I think will also update ids of multiple features automatically). The other seems to have the same definition in postgis and qgis, but does not. Is there a key setting that I am missing? This is the definition of both my tables in postgis:
Property Value
Name id
Position 1
Data type integer
Collation
Default nextval('seq1'::regclass)
Sequence seq1
Not NULL? Yes
Primary key? Yes
Foreign key? No
Storage PLAIN
Inherited No
Statistics -1
System column? No
ACL
Comment
-- Column: id
ALTER TABLE x ADD COLUMN id integer;
ALTER TABLE x ALTER COLUMN id SET NOT NULL;
ALTER TABLE x ALTER COLUMN id SET DEFAULT nextval('seq1'::regclass);
And the other
Property Value
Name id
Position 1
Data type integer
Collation
Default nextval('seq2'::regclass)
Sequence seq2
Not NULL? Yes
Primary key? Yes
Foreign key? No
Storage PLAIN
Inherited No
Statistics -1
System column? No
ACL
Comment
-- Column: id
ALTER TABLE y ADD COLUMN id integer;
ALTER TABLE y ALTER COLUMN id SET NOT NULL;
ALTER TABLE y ALTER COLUMN id SET DEFAULT nextval('seq2'::regclass);
And QGIS metadata definitions:
Doesn't work Metadata
General Storage type of this layer PostgreSQL database with PostGIS extension Description of this provider PostgreSQL/PostGIS provider PostgreSQL 9.3.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit PostGIS 2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 Source for this layer dbname='x' host=y port=5432 user='z' sslmode=disable key='id' table="xx" (geom) sql= Geometry type of the features in this layer Polygon Primary key attributes id The number of features in this layer 249 Editing capabilities of this layer Add Features, Delete Features, Change Attribute Values, Add Attributes, Delete Attributes, Fast Access to Features at ID, Change Geometries, Simplify Geometries, Simplify Geometries with topological validation
Does work metadata
General Storage type of this layer PostgreSQL database with PostGIS extension Description of this provider PostgreSQL/PostGIS provider PostgreSQL 9.3.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit PostGIS 2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 Source for this layer dbname='a' host=b port=5432 sslmode=disable key='id' srid=4326 type=MULTIPOLYGON table="c" (geom) sql= Geometry type of the features in this layer Polygon Primary key attributes id The number of features in this layer 128 Editing capabilities of this layer Add Features, Delete Features, Change Attribute Values, Add Attributes, Delete Attributes, Fast Access to Features at ID, Change Geometries, Simplify Geometries, Simplify Geometries with topological validation
Below is the editor view when I add a feature to the working layer - I get nothing in either box when adding to the other layer.