Opened 15 years ago

Closed 15 years ago

#1713 closed bug (fixed)

PostgreSQL error message is odd: only last error is shown (others not shown)

Reported by: mwtoews Owned by: nobody
Priority: major: does not work as expected Milestone: Version 1.0.3
Component: Data Provider Version: Trunk
Keywords: postgresql, postgis Cc:
Must Fix for Release: No Platform: Windows
Platform Version: Awaiting user input: no

Description

I'm going to describe this bug by example. Reply if you need more info to reproduce this behaviour.

I have a PostgreSQL database where I explicitly declare permissions on schema, table, etc. Normally, if I add a new table with a serial primary key and forget to set permissions for the sequence for certain roles, an error is normally returned. I see this error in, for example, an ODBC connection to MS Access or in pgAdmin logged in under the restricted role:

ERROR: permission denied for sequence foo_gid_seq

In QGIS (1.0.2 stable and 1.2.0 unstable), the behaviour is different. After drawing a new geometry and editing attributes and saving edits, the error message is instead:

ERROR:  invalid input syntax for integer: ""

This problem took me a while to debug in QGIS, since it wasn't particularly useful. Inspecting the pgsql logs on the server, I see:

2009-05-22 17:25:29 PDT ERROR:  permission denied for sequence foo_gid_seq
2009-05-22 17:25:29 PDT STATEMENT:  select nextval('foo_gid_seq'::regclass)
2009-05-22 17:25:29 PDT ERROR:  invalid input syntax for integer: ""
2009-05-22 17:25:29 PDT STATEMENT:  INSERT INTO "public"."foo"("geometry","gid","name") VALUES (GeomFromWKB($1::bytea,26910),$2,'Vancouver')

It appears that QGIS skips reporting the first error message, and only reports the second error message. (I'm also unsure why the transaction continues after the first error, but I don't really know the internals of how transactions work in QGIS with PG .. is "select nextval('foo_gid_seq'::regclass)" run separately from the second command, or is it internal to the PG database?).

My PostGIS server is installed on Ubuntu Hardy (all via apt-get) with postgis_full_version() info: POSTGIS="1.3.3" GEOS="2.2.3-CAPI-1.1.1" PROJ="Rel. 4.6.0, 21 Dec 2007" USE_STATS

Change History (1)

comment:1 by jef, 15 years ago

Resolution: fixed
Status: newclosed

fixed in r10863

Note: See TracTickets for help on using tickets.