Bug report #12040

Error and segmentation fault adding new columns to PostGIS layers

Added by Pedro Venâncio over 9 years ago. Updated over 9 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Attribute table
Affected QGIS version:master Regression?:No
Operating System:Windows and Linux Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:20243

Description

- If you create one new column in the attribute table of a layer PostGIS, and save, everything is fine.

- If you create two new columns, and saves only after the two columns have been created, QGIS throws an error:

Could not commit changes to layer pedreiras

Errors: SUCCESS: 2 attribute(s) added.
  ERROR: 37 attribute value change(s) not applied.

  Provider errors:
      PostGIS error while changing attributes: ERROR:  syntax error at or near "WHERE" 
    LINE 1: UPDATE "ocorrencias_minerais"."pedreiras" SET  WHERE "id"=0

Despite this error, the columns are created in the database, but apparently, after adding the columns, QGIS tries to do some more update.

It happens to me both creating the new columns with "New column" and with the "Field Calculator".

I've tested it with layers of points and polygons, and with columns of different types. The result is the same. I've also tested on Windows (OSGeo4W) and Linux.

After the error, QGIS crashes with a segmentation fault:

pedro@tsunami:~$ gdb /usr/bin/qgis.bin
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying" 
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /usr/bin/qgis.bin...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/qgis.bin 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_US]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_US]
Warning: QGraphicsScene::addItem: item has already been added to this scene
[New Thread 0xb5380b40 (LWP 19066)]
[New Thread 0xb4a7fb40 (LWP 19067)]
Debugger not enabled
Warning: Object::disconnect: Unexpected null parameter
[New Thread 0xae88db40 (LWP 19125)]
Warning: QGraphicsScene::addItem: item has already been added to this scene
[New Thread 0xad02cb40 (LWP 19171)]
[New Thread 0xac62bb40 (LWP 19172)]
[New Thread 0xabe2ab40 (LWP 19173)]

Program received signal SIGSEGV, Segmentation fault.
0x03439ada in QVariant::QVariant(QVariant const&) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
(gdb) continue
Continuing.
QGIS died on signal 11[Thread 0xac62bb40 (LWP 19172) exited]
[Thread 0xad02cb40 (LWP 19171) exited]
[Thread 0xae88db40 (LWP 19125) exited]
[Thread 0xabe2ab40 (LWP 19173) exited]
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operação não permitida.
No thread selected
No stack.
gdb returned 0

Program received signal SIGABRT, Aborted.
0x00132416 in __kernel_vsyscall ()
(gdb) continue
Continuing.
[Thread 0xb4a7fb40 (LWP 19067) exited]
[Thread 0xb5380b40 (LWP 19066) exited]

Program terminated with signal SIGABRT, Aborted.
The program no longer exists.
(gdb)

This only happens to me with QGIS master. Tested in QGIS 2.4, 2.6.0 and 2.6.1 without problems, so it is a regression.

To reproduce:

1) Open QGIS
2) Load a PostGIS layer
3) Open the attribute table
4) Start editing
5) "New column (Ctrl+W)" and give a name to the new field
6) "New column (Ctrl+W)" again and give a name to the second new field
7) Save edits

Associated revisions

Revision 843cf049
Added by Jürgen Fischer over 9 years ago

database providers: cope with empty attribute changes (fixes #12040)

History

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

  • Status changed from Open to Closed

Also available in: Atom PDF