Bug report #17078

Bug in "Filter" feature while using database table as layer with multiple geometry fields

Added by Ramin Mirsharifi over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Affected QGIS version:2.18.12 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:not reproducable
Crashes QGIS or corrupts data:No Copied to github as #:24977

Description

To produce the problem:
There is a table in PostGIS named "dp_roads" with "geom" and "center_point" fields (both geometry fields).
I need to to choose one of the geometry fields, for example "geom"
I see the layer as "dp_road(geom)".
when I try to use "Filter" feature, there will be error:
"An error occurred when executing the query. LINE 1: ...CURSOR for SELECT * FROM "dp_road(geom)" "

seems it is looking for a table named "dp_roads(geom)" instead of "dp_roads"

History

#1 Updated by Giovanni Manghi over 6 years ago

  • Project changed from QGIS Redmine (QGIS bug tracker) to QGIS Application
  • Affected QGIS version set to 2.18.12
  • Status changed from Open to Feedback
  • Category changed from Any to Vectors
  • Subject changed from Bug in "Filter" feature while using database table as layer with multiple geometry fields. to Bug in "Filter" feature while using database table as layer with multiple geometry fields
  • Easy fix? set to No
  • Regression? set to No
  • Crashes QGIS or corrupts data set to No

I tried on 2.18.12 and I'm not able to replicate (please eventually provide precise steps to, very unclear what you mean with "I need to to choose one of the geometry fields, for example "geom", I see the layer as "dp_road(geom)""):

what I see in the "filter" dialog is the second geometry column listed as a normal attribute, eventually this is a bug as it should not as the "filter" functionality does not have operators for geometries(? unsure).

#2 Updated by Ramin Mirsharifi over 6 years ago

  • Status changed from Feedback to Open

Giovanni Manghi wrote:

I tried on 2.18.12 and I'm not able to replicate (please eventually provide precise steps to, very unclear what you mean with "I need to to choose one of the geometry fields, for example "geom", I see the layer as "dp_road(geom)""):

what I see in the "filter" dialog is the second geometry column listed as a normal attribute, eventually this is a bug as it should not as the "filter" functionality does not have operators for geometries(? unsure).

Thank you for your response, I try to make it clear:

There is a table named "dp_roads" with these columns:

NAME - TYPE
--------------------------
geom - linestring
center_point - point
title - string

I use "Add Vector Layer" from "Database" the "geom" column are added as layer named:
"PG:dbname='gis' host='localhost' port='5432' user='ramin' password='??' dp_road(geom)"

I use "Filter" on it and in "Query Builder" dialog I try filter on "title" column:
"title" = ""

Error is generated:
LINE 1: ...RSOR for SELECT * FROM "dp_road(geom)" WHERE "title"=''

Actually the correct SQL query might be "SELECT * FROM "dp_road" WHERE "title"=''"

#3 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Open to Feedback

Ramin Mirsharifi wrote:

Giovanni Manghi wrote:

I tried on 2.18.12 and I'm not able to replicate (please eventually provide precise steps to, very unclear what you mean with "I need to to choose one of the geometry fields, for example "geom", I see the layer as "dp_road(geom)""):

what I see in the "filter" dialog is the second geometry column listed as a normal attribute, eventually this is a bug as it should not as the "filter" functionality does not have operators for geometries(? unsure).

Thank you for your response, I try to make it clear:

while is possible to add a postgis layer using

add vector > database > ...

you should not do that, the proper way is using the "add postgis layer" dialog, the QGIS browser or DB Manager. This way the layer is added with its proper name, the table name.

Anyway... I tested also creating a layer with multiple geometry columns and add it using the "add vector > database > ..." rout. The layer is added with a name (its uri) that of course does not make sense (this is a real bug, please file a separate ticket) also because it contains the password. Then I tries t apply a filter... and got not issues.

Please attach a sql dump of your layer.

#4 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Feedback to Closed
  • Resolution set to not reproducable

Closing for lack of feedback, please reopen if necessary.

Also available in: Atom PDF