Bug report #8151
Creating a view in DB Manager causes python error and qgis must be killed
| Status: | Closed | ||
|---|---|---|---|
| Priority: | High | ||
| Assignee: | - | ||
| Category: | DB Manager | ||
| Affected QGIS version: | master | Regression?: | No |
| Operating System: | Easy fix?: | No | |
| Pull Request or Patch supplied: | No | Resolution: | worksforme |
| Crashes QGIS or corrupts data: | Yes | Copied to github as #: | 16979 |
Description
Apparently in DB Manager I can create a view like
CREATE VIEW test_view AS
SELECT a.gid AS gid, a.descricao, ST_Intersection(a.geom,b.geom)::geometry(LineString,3763) AS geom
FROM training.rede_ferroviaria a, training.evora b
WHERE ST_Intersects(a.geom, b.geom);
without errors.
If the same query is done to create a table it would give
Geometry type (MultiLineString) does not match column type (LineString)
So... if afterwards I open the "table" or "preview" tab of the created view, DB Manager will give first
Traceback (most recent call last):
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\data_model.py", line 60, in data
val = self.getData(index.row(), index.column())
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\data_model.py", line 116, in getData
self.fetchMoreData(start)
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\postgis\\data_model.py", line 76, in fetchMoreData
return self.fetchMoreData(row_start)
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\postgis\\data_model.py", line 78, in fetchMoreData
self.resdata = self.cursor.fetchmany(self.fetchedCount)
DataError: Geometry type (MultiLineString) does not match column type (LineString)
and then
Traceback (most recent call last):
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\data_model.py", line 60, in data
val = self.getData(index.row(), index.column())
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\data_model.py", line 116, in getData
self.fetchMoreData(start)
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\postgis\\data_model.py", line 76, in fetchMoreData
return self.fetchMoreData(row_start)
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\postgis\\data_model.py", line 70, in fetchMoreData
self._createCursor()
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\postgis\\data_model.py", line 49, in _createCursor
self.db._execute(self.cursor, sql)
File "C:/OSGeo4W/apps/qgis-dev/./python/plugins\\db_manager\\db_plugins\\connector.py", line 84, in _execute
raise DbError(e, sql)
DbError: Error:
current transaction is aborted, commands ignored until end of transaction block
over and over, and the only way out is to kill the program.
History
#1
Updated by Daniel Vaz over 12 years ago
Please, can you attach some dataset to reproduce the bug?
#2
Updated by Giovanni Manghi over 12 years ago
- File tests_dbmanager.tar.gz added
Daniel Vaz wrote:
Please, can you attach some dataset to reproduce the bug?
attached. Import both vectors in PostGIS then run the query is
CREATE VIEW test_view AS
SELECT a.gid AS gid, a.descricao, ST_Intersection(a.geom,b.geom)::geometry(LineString,3763) AS geom
FROM rede_ferroviaria a, evora b
WHERE ST_Intersects(a.geom, b.geom);
#3
Updated by Jürgen Fischer over 11 years ago
- Status changed from Open to Feedback
Not reproducable - the query fails, the "Database Error" window with the error message pops up, Table and Preview tabs are empty. Changing to an other layer and back doesn't reproduce the error, unless the tree is refreshed.
#4
Updated by Giovanni Manghi over 11 years ago
- Resolution set to worksforme
- Status changed from Feedback to Closed
seems that in the meantime somehow the issue was fixed.