Bug report #1713

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

Added by Mike Taves over 15 years ago. Updated over 15 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Data Provider
Affected QGIS version: Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:11773

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

Associated revisions

Revision 3f60d725
Added by Jürgen Fischer over 15 years ago

- allow setting of field width and precision when adding attributes
- update vector data providers accordingly
- postgres provider:
- add support for more native types and setting of column comments
- catch errors on retrieval of defaults values (fixes #1713)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10863 c8812cc2-4d05-0410-92ff-de0c093fc19c

Revision 3e01e6d3
Added by Jürgen Fischer over 15 years ago

- allow setting of field width and precision when adding attributes
- update vector data providers accordingly
- postgres provider:
- add support for more native types and setting of column comments
- catch errors on retrieval of defaults values (fixes #1713)

git-svn-id: http://svn.osgeo.org/qgis/trunk@10863 c8812cc2-4d05-0410-92ff-de0c093fc19c

History

#1 Updated by Jürgen Fischer over 15 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

fixed in 3e01e6d3 (SVN r10864)

Also available in: Atom PDF