Bug report #21745

PostgreSQL identity column not recognized properly

Added by Michal Zimmermann about 5 years ago. Updated almost 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:3.6.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29560

Description

Having the following table definition:

CREATE TABLE test (id integer generated always as identity primary key, geom geometry(point, 4326));

features cannot be added to QGIS, because the Feature Attributes dialogue requires id column to be not null. However, when any value is filled, the saving fails with the following error:

Could not commit changes to layer test

Errors: ERROR: 1 feature(s) not added.

  Provider errors:
      PostGIS error while adding features: ERROR:  cannot insert into column "id" 
    DETAIL:  Column "id" is an identity column defined as GENERATED ALWAYS.
    HINT:  Use OVERRIDING SYSTEM VALUE to override.

According to https://blog.2ndquadrant.com/postgresql-10-identity-columns/, the syntax of identity columns in PostgreSQL conforms to the SQL standard and it's been around for a while.

Associated revisions

Revision 59dd8510
Added by Jürgen Fischer about 5 years ago

[FEATURE] postgres provider: add support for generated identity columns (implements #21745)

History

#1 Updated by Jürgen Fischer about 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#2 Updated by Michal Zimmermann almost 5 years ago

Jürgen Fischer wrote:

Applied in changeset qgis|59dd85103ddbfc640662c9ed220235d94cb7c7c2.

How do I tell which QGIS version will include this fix?

#3 Updated by Jürgen Fischer almost 5 years ago

Michal Zimmermann wrote:

Jürgen Fischer wrote:

Applied in changeset qgis|59dd85103ddbfc640662c9ed220235d94cb7c7c2.

How do I tell which QGIS version will include this fix?

It's in master and will be in 3.8.

Also available in: Atom PDF