4

Why is Postgres user XX via command „Add PostGIS Layers“ in QGIS enabled upload only View tables which owns? Or how to achieve it to the user XX via PostGIS can load View table which owns the user YY?

Main table from the database with different users are assigned by rolls, however the View tables we could not find that there is a possibility of assigning rolls.

Any idea how solve this problem?

Mike T
  • 42,095
  • 10
  • 126
  • 187
brunci
  • 255
  • 2
  • 9
  • you need to be postgres root (superuser) to view all tables. Is a security feature of postgres. Use the GRANT feature - http://www.postgresql.org/docs/9.0/static/sql-grant.html – Mapperz Apr 17 '13 at 13:32

3 Answers3

3

The QGIS table browser has a well-hidden option that you need to toggle to tell it what column to use as a unique key before it will let you display a view.

How to make a spatial view in PostGIS and add it as a layer in QGIS?

Which means, also, your view has to include a unique column to use as a key.

Paul Ramsey
  • 19,865
  • 1
  • 47
  • 57
  • brunci has a problem that he can not see any of View tabels that the owner of the table can see (There is no problem with unique column) – hapa Apr 18 '13 at 06:42
3


user XX must give privilege to user YY on that view table
in PgAdmin SQL editor user XX should write:

GRANT SELECT ON TABLE "view table" TO "ROLE XYZ"


and of course user YY must be member of ROLE XYZ

hapa
  • 421
  • 3
  • 9
0

for me, typecasting worked, e.g.:

CREATE VIEW myview AS SELECT id,
                      ST_Buffer(geom_pt,2.6)::geometry(Polygon,25832) AS mybuffer
                      FROM myoriginaltable;
Taras
  • 32,823
  • 4
  • 66
  • 137
TimKlein
  • 1
  • 1