Commit 66e5ecbd authored by x42p's avatar x42p Committed by Steve Müller

Update PostgreSqlPlatform.php

If the database have different schemes, with objects, that the actual logged in user has no rights, the existing statements will collect all objects (sequences and tables) and try to read them in later steps. This will throws exceptions. The reason for that is the fact, that both procedures getListSequencesList() and getListTablesSQL() will receive all known database objects from postgres catalogs. But the actual logged-in user, maby has no read permissions to object inside other scheme-owner. The additional parts inside both sql-statements will reduce the result to only objects that the user are able to see.
parent 1fb042df
......@@ -247,8 +247,10 @@ class PostgreSqlPlatform extends AbstractPlatform
c.relname, n.nspname AS schemaname
FROM
pg_class c, pg_namespace n
WHERE relkind = 'S' AND n.oid = c.relnamespace AND
(n.nspname NOT LIKE 'pg_%' AND n.nspname != 'information_schema')";
WHERE relkind = 'S'
AND n.oid = c.relnamespace
AND (n.nspname NOT LIKE 'pg_%' AND n.nspname != 'information_schema')
AND pg_table_is_visible(oid) is true";
}
/**
......@@ -256,8 +258,17 @@ class PostgreSqlPlatform extends AbstractPlatform
*/
public function getListTablesSQL()
{
return "SELECT quote_ident(tablename) AS table_name, schemaname AS schema_name
FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' AND schemaname != 'information_schema' AND tablename != 'geometry_columns' AND tablename != 'spatial_ref_sys'";
return "SELECT quote_ident(t.tablename) AS table_name,
t.schemaname AS schema_name
FROM pg_tables t,
pg_class c
WHERE t.tablename = c.relname
AND c.relkind = 'r'
AND pg_table_is_visible(c.oid) is true
AND t.schemaname NOT LIKE 'pg_%'
AND schemaname != 'information_schema'
AND tablename != 'geometry_columns'
AND tablename != 'spatial_ref_sys'";
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment