3

The following query executes in 0.149 seconds but the results will not display in the box in the bottom half of the DB Manager window, which I assume is the results window (PgAdmin returns 7 rows with same query):

select * from region;

The query runs in PgAdmin4 and the results are shown in PgAdmin upon execution returning the 7 rows.

The view from this query can be created in DB Manager after execution and added to the canvas in QGIS.

I'm running QGIS 3.12.2 (I upgraded today to see if it would fix the issue having encountered this in 3.12 last week).

SQL result window is blank but should display results from 7 rows

imre
  • 550
  • 1
  • 5
  • 14
Shane Rich
  • 99
  • 6
  • 1
    What about select * from public.region; or select * from "region"; do the other tables work? – HeikkiVesanto Apr 20 '20 at 20:29
  • @HeikkiVesanto, executes as public.region but still does not display in results window. This applies to all my databases in PostGIS in DB Manager, queried tables don't show results after a query. Results are displayed when performing an SQL in DB Manager for GeoPackage or Spatialite though. – Shane Rich Apr 21 '20 at 14:31
  • Queries work fine for me with QGIS 3.12.1. Do you have read permissions on the table and schema? – HeikkiVesanto Apr 21 '20 at 14:48
  • @HeikkiVesanto yes I believe so; it's data from the QGIS tutorial data package. Tutorial 19, Using Spatial Databases in QGIS. – Shane Rich Apr 22 '20 at 10:50
  • And can you see the data when you click on the table in DB Manager and go to the Table tab? Are you using the same PostgreSQL account in PgAdmin4 and DB Manager? – HeikkiVesanto Apr 22 '20 at 11:34
  • @HeikkiVesanto, yes, and yes. The expression executes fine (I know this as I can export the view to the canvas), it just won't show in the results window. The SQL results show in the results window for a geopackage or Spatial Lite query though. Just not PostGIS. – Shane Rich Apr 24 '20 at 13:15

2 Answers2

4

Having read this post on GitHub today (https://github.com/qgis/QGIS/issues/36205#issuecomment-627026433), I tried to run the query without a semicolon and it worked:

select * from region

Shane Rich
  • 99
  • 6
0

I had similar problem (which I just solved using this thread)

My OS is Manjaro and it seemed that some of the plugins were not shipped properly/could not be loaded. I had to follow the directions in the thread mentioned above.

Especially:

sudo pacman -S python-gdal python-psycopg2 python-owslib python-pygments

seemed to do the trick.

I encountered a problem when installing the gdal package. I got the following errors

error: failed to commit transaction (conflicting files)
python-numpy: /usr/bin/f2py exists in filesystem
python-numpy: /usr/bin/f2py3 exists in filesystem
Errors occurred, no packages were upgraded.

Based on the answer here I had to manually (as pacman and pip uninstall did not had any effect) remove the files in question by running the following commands

sudo rm /usr/bin/f2py
sudo rm /usr/bin/f2py3
Bartors
  • 159
  • 7