Skip to content

pgVersion fails on tables with "GENERATED ALWAYS AS IDENTITY" primary key #35

@antoniusz

Description

@antoniusz

When initializing versioning on a table whose primary key is defined as an integer GENERATED ALWAYS AS IDENTITY, pgVersion raises:

TypeError: 'RaiseException' object is not subscriptable
Traceback (most recent call last):
File "/home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/pgversion/dbtools/dbtools.py", line 136, in run
rows = cursor.execute(sql)
psycopg2.errors.RaiseException: Table public.monumente_hr does not has a serial defined
CONTEXT: PL/pgSQL function versions._hasserial(character varying) line 34 at RAISE
SQL statement "select * from versions._hasserial('public.monumente_hr')"
PL/pgSQL function versions.pgvsinit(character varying) line 57 at EXECUTE

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/pgversion/pgVersion.py", line 313, in doInit
result, error = myDb.run(sql)
~~~~~~~~^^^^^
File "/home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/pgversion/dbtools/dbtools.py", line 143, in run
self._error_message(e)
~~~~~~~~~~~~~~~~~~~^^^
File "/home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/pgversion/dbtools/dbtools.py", line 309, in _error_message
QMessageBox.information(None,'PG: Error', str(e[1]))
~^^^
TypeError: 'RaiseException' object is not subscriptable

Python-verzió: 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0]
QGIS-verzió: 3.44.4-Solothurn Solothurn, 2d26abd4f30


my table

CREATE TABLE public.monumente_hr (
ogc_fid int4 GENERATED ALWAYS AS IDENTITY NOT NULL,
wkb_geometry public.geometry(multipolygon, 3844) NULL,
.......

CONSTRAINT monumente_hr_pkey PRIMARY KEY (ogc_fid)

);
CREATE INDEX sidx_monumente_hr_wkb_geometry ON public.monumente_hr USING gist (wkb_geometry);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions