diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2012-02-27 13:10:40 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2012-02-29 12:32:51 +0100 |
commit | 01dadc1753da47664eab338f41aa3e3b0f5b5cfb (patch) | |
tree | 2a18423361b8f1e1c6d87bcec7d43df2df9177a9 | |
parent | 740bd815235557336757563823c8d35bf75c6fbf (diff) |
fdo#46675: expand group memberships in PostgreSQL-SDBC get*Privileges
Signed-off-by: Michael Meeks <michael.meeks@suse.com>
Signed-off-by: Michael Stahl <mstahl@redhat.com>
Signed-off-by: Norbert Thiebaud <nthiebaud@gmail.com>
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_databasemetadata.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index bfc7be01bf60..6b6b8fe8f1e7 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -1732,7 +1732,8 @@ static void columnMetaData2DatabaseTypeDescription( rtl::OUStringBuffer sSQL(260); sSQL.append( ASCII_STR( - " SELECT * FROM (" + " SELECT dp.TABLE_CAT, dp.TABLE_SCHEM, dp.TABLE_NAME, dp.GRANTOR, pr.rolname AS GRANTEE, dp.privilege, dp.is_grantable " + " FROM (" " SELECT table_catalog AS TABLE_CAT, table_schema AS TABLE_SCHEM, table_name," " grantor, grantee, privilege_type AS PRIVILEGE, is_grantable" " FROM information_schema.table_privileges") ); @@ -1754,8 +1755,9 @@ static void columnMetaData2DatabaseTypeDescription( " WHERE c.relkind IN ('r', 'v') AND c.relacl IS NULL AND pg_has_role(rg.oid, c.relowner, 'USAGE')" " AND c.relowner=ro.oid AND c.relnamespace = pn.oid") ); sSQL.append( ASCII_STR( - " ) s" - " WHERE table_schem LIKE ? AND table_name LIKE ? " + " ) dp," + " (SELECT oid, rolname FROM pg_catalog.pg_roles UNION ALL VALUES (0, 'PUBLIC')) pr" + " WHERE table_schem LIKE ? AND table_name LIKE ? AND (dp.grantee = 'PUBLIC' OR pg_has_role(pr.oid, dp.grantee, 'USAGE'))" " ORDER BY table_schem, table_name, privilege" ) ); Reference< XPreparedStatement > statement = m_origin->prepareStatement( sSQL.makeStringAndClear() ); |