Bug report #17363

DB Manager cannot load a PG Raster with a complex name

Added by Mike Taves about 7 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:DB Manager
Affected QGIS version:2.18.13 Regression?:No
Operating System:Windows 10 Easy fix?:Yes
Pull Request or Patch supplied:No Resolution:no timely feedback
Crashes QGIS or corrupts data:No Copied to github as #:25260

Description

A PostGIS geometry table with a complex name can successfully be added to QGIS via DB Manager:

CREATE TABLE public."dot.geom" 
(
  gid serial NOT NULL,
  geom geometry(Point,2193)
);

However, a similarly named raster table cannot be added to QGIS via DB Manager:

CREATE TABLE public."dot.rast" 
(
  rid serial NOT NULL,
  rast raster
);

The only useful error message from the "Enter Credentials" dialog has:

Cannot open GDAL dataset PG: dbname= <... snip ...> :
Error browsing database for PostGIS Raster properties :
Error: cross-database references are not implemented: "public.dot.rast"
LINE 1: ...rast)) scale_x, avg(ST_ScaleY(rast)) scale_y from public.dot...

The easier-to-find Log message from DBManagerPlugin does not show the previous message, only a generic:

PG: dbname=postgis host=localhost user=postgres port=5436 mode=2 schema=public column=rast table=dot.rast is an invalid layer - not loaded

The bug is easily identified in the first error message: public.dot.rast is not a valid table/view name, but "public"."dot.rast" is valid. I'm not sure where the error is located in the source code, but all PostgreSQL objects need to use something like `quote_ident` or `PQescapeLiteral` to function normally.

There doesn't appear to be any issues with the first example with "public"."dot.geom", so all good there!

History

#1 Updated by Jürgen Fischer almost 6 years ago

  • Status changed from Open to Feedback

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#2 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to no timely feedback
  • Status changed from Feedback to Closed

Closing for lack of feedback.

Also available in: Atom PDF