Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 2647FB5DBF7 for ; Thu, 18 Aug 2011 07:22:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 35063-02 for ; Thu, 18 Aug 2011 10:22:15 +0000 (UTC) X-Greylist: delayed 01:06:45.485746 by SQLgrey-1.7.6 Received: from mailout.thl.fi (mailout.thl.fi [193.167.195.59]) by mail.postgresql.org (Postfix) with ESMTP id 4D815B5DBEE for ; Thu, 18 Aug 2011 07:22:14 -0300 (ADT) Received: from mailout (localhost.localdomain [127.0.0.1]) by mailout.thl.fi (8.13.1/8.13.1) with SMTP id p7I9FQJT007410 for ; Thu, 18 Aug 2011 12:15:26 +0300 Received: from 172.24.32.92 (172.24.32.92) by mailout (F-Secure/fsigk_smtp/580/mailout); Thu, 18 Aug 2011 12:15:26 +0200 (EET) X-Virus-Status: clean(F-Secure/fsigk_smtp/580/mailout) Received: from exhub1.stakes.fi (exhub1.stakes.fi [10.10.3.203]) by mail-hub.thl.fi (8.13.8/8.13.8) with ESMTP id p7I9FQnM012653 for ; Thu, 18 Aug 2011 12:15:26 +0300 Received: from [172.24.90.216] (172.24.90.216) by exhub1.stakes.fi (10.10.3.203) with Microsoft SMTP Server id 8.3.83.0; Thu, 18 Aug 2011 12:15:26 +0300 Message-ID: <4E4CD82E.3040102@thl.fi> Date: Thu, 18 Aug 2011 12:15:26 +0300 From: Jonas Sundman User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: Subject: getTablePrivileges empty if table owned by group role Content-Type: text/plain; charset="ISO-8859-15"; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.037 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.137 X-Spam-Level: X-Archive-Number: 201108/41 X-Sequence-Number: 22073 Hi, I came across a situation which revealed that getTablePrivileges is not returning any grants if a table is owned by a group role, i.e. a role wihout login attribute. The connection is opened with superuser priviliges. This code runs with the latest 8.4 driver (702) agains a 8.4.8 database. public static void listprivs() throws SQLException{ ResultSet rs = con.getMetaData().getTablePrivileges(null, "public", "test"); int i = 0; while (rs.next()) { System.out.print("grantee: " + rs.getString("GRANTEE")); System.out.println(", privilege: " + rs.getString("PRIVILEGE")); i++; } System.out.println("Total: " + i); } public static void main(String[] args) throws ClassNotFoundException, SQLException { Class.forName("org.postgresql.Driver"); con = DriverManager.getConnection("jdbc:postgresql://localhost/test", "user", "****"); con.setAutoCommit(true); Statement stmt = con.createStatement(); stmt.executeUpdate("create table test (a int)"); stmt.executeUpdate("create role test_group"); stmt.executeUpdate("alter table test owner to test_group"); System.out.println("Initial case"); listprivs(); stmt.executeUpdate("alter role test_group login"); System.out.println("login attribute set"); listprivs(); stmt.executeUpdate("drop table test"); stmt.executeUpdate("drop role test_group"); } } Output: Initial case Total: 0 Group with login grantee: test_group, privilege: DELETE grantee: test_group, privilege: INSERT grantee: test_group, privilege: REFERENCES grantee: test_group, privilege: RULE grantee: test_group, privilege: SELECT grantee: test_group, privilege: TRIGGER grantee: test_group, privilege: UPDATE Total: 7 To my understanding, the result should be the same in both cases. The result is the same even if there are explicit grants on the table to some other role. Regards, Jonas Sundman