pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedStrange result from DatabaseMetaData.getTablePrivileges()
2+ messages / 2 participants
[nested] [flat]
* Strange result from DatabaseMetaData.getTablePrivileges()
@ 2007-01-28 17:26 Thomas Kellerer <spam_eater@gmx.net>
2007-01-28 22:36 ` Re: Strange result from DatabaseMetaData.getTablePrivileges() Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Kellerer @ 2007-01-28 17:26 UTC (permalink / raw)
To: pgsql-jdbc
Hello,
I just noticed that getTablePrivileges() returns the same privilege for the same
user multiple times. Additionally it returns several rows with the privilege
"UNKNOWN".
Is this a bug, or am I simply misunderstanding something?
The following test code:
Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://localhost/wbtest",
"thomas", "****");
con.setAutoCommit(true);
stmt = con.createStatement();
stmt.executeUpdate("create table test_table (nr integer)");
stmt.executeUpdate("grant select,insert,update on test_table to postgres");
rs = con.getMetaData().getTablePrivileges(null, "public", "test_table");
while (rs.next())
{
System.out.print("table_name: " + rs.getString("TABLE_NAME"));
System.out.print(", grantor: " + rs.getString("GRANTOR"));
System.out.print(", grantee: " + rs.getString("GRANTEE"));
System.out.println(", privilege: " + rs.getString("PRIVILEGE"));
}
stmt.executeUpdate("drop table test_table");
produces the following ouput:
table_name: test_table, grantor: thomas, grantee: thomas, privilege: DELETE
table_name: test_table, grantor: thomas, grantee: thomas, privilege: INSERT
table_name: test_table, grantor: thomas, grantee: thomas, privilege: INSERT
table_name: test_table, grantor: thomas, grantee: postgres, privilege: INSERT
table_name: test_table, grantor: thomas, grantee: postgres, privilege: INSERT
table_name: test_table, grantor: thomas, grantee: thomas, privilege: REFERENCES
table_name: test_table, grantor: thomas, grantee: thomas, privilege: SELECT
table_name: test_table, grantor: thomas, grantee: postgres, privilege: SELECT
table_name: test_table, grantor: thomas, grantee: thomas, privilege: TRIGGER
table_name: test_table, grantor: thomas, grantee: thomas, privilege: TRIGGER
table_name: test_table, grantor: thomas, grantee: postgres, privilege: TRIGGER
table_name: test_table, grantor: thomas, grantee: thomas, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: thomas, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: thomas, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: thomas, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: thomas, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: postgres, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: postgres, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: postgres, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: postgres, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: postgres, privilege: UNKNOWN
table_name: test_table, grantor: thomas, grantee: thomas, privilege: UPDATE
table_name: test_table, grantor: thomas, grantee: postgres, privilege: UPDATE
Note that e.g. the INSERT privilege for the user postgres is returned twice,
whereas the SELECT privilege for the user postgres is only returned once (which
is what I would have expected)
And what are all the UNKNOWN entries?
This is with build 504 of the JDBC Driver running on Windows XP against a
Postgres 8.2.1 installed on the same machine using JDK 1.5.
Thomas
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Strange result from DatabaseMetaData.getTablePrivileges()
2007-01-28 17:26 Strange result from DatabaseMetaData.getTablePrivileges() Thomas Kellerer <spam_eater@gmx.net>
@ 2007-01-28 22:36 ` Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 2+ messages in thread
From: Kris Jurka @ 2007-01-28 22:36 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc
On Sun, 28 Jan 2007, Thomas Kellerer wrote:
> I just noticed that getTablePrivileges() returns the same privilege for the
> same user multiple times. Additionally it returns several rows with the
> privilege "UNKNOWN".
This is a known bug. The ACL parsing code has not been updated since the
7.3 release and the format has changed numerous times.
Kris Jurka
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-01-28 22:36 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-01-28 17:26 Strange result from DatabaseMetaData.getTablePrivileges() Thomas Kellerer <spam_eater@gmx.net>
2007-01-28 22:36 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox