pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedgetMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows
2+ messages / 2 participants
[nested] [flat]
* getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows
@ 2010-07-28 04:30 Panon, Paul-Andre <Paul-AndrePanon@SierraSystems.com>
2010-07-28 16:02 ` Re: getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows dmp <danap@ttc-cmc.net>
0 siblings, 1 reply; 2+ messages in thread
From: Panon, Paul-Andre @ 2010-07-28 04:30 UTC (permalink / raw)
To: pgsql-jdbc
The PostgreSQL driver appears to be causing some unexpected behaviour for the OpenNMS installer on Windows.
In the following code snippet, the table row set returned includes TABLEs, SEQUENCEs, and INDEXes. Shouldn't getTables be filtering out and returning only tables and views?
public void databaseSetUser() throws SQLException {
Connection adminConn = getAdminConnection();
ResultSet rs = adminConn.getMetaData().getTables(null, "public", "%", null);
HashSet<String> objects = new HashSet<String>();
while (rs.next()) {
m_out.println(rs.getString("TABLE_NAME")+" "+ rs.getString("TABLE_TYPE") +" "+ rs.getString("REMARKS"));
objects.add(rs.getString("TABLE_NAME"));
}
PreparedStatement st = getAdminConnection().prepareStatement("ALTER TABLE ? OWNER TO ?");
for (String objName : objects) {
st.setString(1, objName);
st.setString(2, m_user);
m_out.println("Would perform ALTER TABLE " + objName + " OWNER TO " + m_user );
/* st.execute(); */
}
st.close();
}
----Notice Regarding Confidentiality----
This email, including any and all attachments, (this “Email”) is intended only for the party to whom it is addressed and may contain information that is confidential or privileged. Sierra Systems Group Inc. and its affiliates accept no responsibility for any loss or damage suffered by any person resulting from any unauthorized use of or reliance upon this Email. If you are not the intended recipient, you are hereby notified that any dissemination, copying or other use of this Email is prohibited. Please notify us of the error in communication by return email and destroy all copies of this Email. Thank you.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows
2010-07-28 04:30 getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows Panon, Paul-Andre <Paul-AndrePanon@SierraSystems.com>
@ 2010-07-28 16:02 ` dmp <danap@ttc-cmc.net>
0 siblings, 0 replies; 2+ messages in thread
From: dmp @ 2010-07-28 16:02 UTC (permalink / raw)
To: Paul-AndrePanon@SierraSystems.com; pgsql-jdbc
>
>
>The PostgreSQL driver appears to be causing some unexpected behaviour for the OpenNMS installer on Windows.
>
>In the following code snippet, the table row set returned includes TABLEs, SEQUENCEs, and INDEXes. Shouldn't getTables be filtering out and returning only tables and views?
>
> public void databaseSetUser() throws SQLException {
> Connection adminConn = getAdminConnection();
> ResultSet rs = adminConn.getMetaData().getTables(null, "public", "%", null);
>
In your argument for getTables(catalog, schemaPattern, tableNamePattern,
tableTypes) you
have specified a null for the tableTypes. That I believe does not place
any restrictions on
the returned table, so VIEW and other types will be returned.
types - A list of table types, which must be from the list of table
types returned from getTableTypes(), to include; null returns
all types.
danap
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2010-07-28 16:02 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-07-28 04:30 getMetaData().getTables() behaviour with JDBC3 8.3 & 8.4 drivers on windows Panon, Paul-Andre <Paul-AndrePanon@SierraSystems.com>
2010-07-28 16:02 ` dmp <danap@ttc-cmc.net>
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