[QGIS-trac] [Quantum GIS] #1713: PostgreSQL error message is odd: only last error is shown (others not shown)

Quantum GIS qgis at qgis.org
Fri May 22 20:56:38 EDT 2009


#1713: PostgreSQL error message is odd: only last error is shown (others not
shown)
------------------------------------------------+---------------------------
   Reporter:  mwtoews                           |              Owner:  nobody       
       Type:  bug                               |             Status:  new          
   Priority:  major: does not work as expected  |          Milestone:  Version 1.0.3
  Component:  Data Provider                     |            Version:  HEAD         
   Keywords:  postgresql, postgis               |   Platform_version:               
   Platform:  Windows                           |           Must_fix:  No           
Status_info:  0                                 |  
------------------------------------------------+---------------------------
 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

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1713>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list