[libpostgresql-jdbc-java] 03/08: In DatabaseMetaData.getSchemas, return the user's own temp schemas, but no others. Previously it wasn't returning the users own temp schema, but was showing all toast temp schemas.
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_2_512
in repository libpostgresql-jdbc-java.
commit a2b56e96ecb3229b7de30fcd5210d8a7fc4d6851
Author: Kris Jurka <books at ejurka.com>
Date: Wed Dec 22 16:54:31 2010 +0000
In DatabaseMetaData.getSchemas, return the user's own temp schemas,
but no others. Previously it wasn't returning the users own temp
schema, but was showing all toast temp schemas.
Per report from Thomas Kellerer.
---
org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java | 6 ++++--
org/postgresql/test/jdbc2/DatabaseMetaDataTest.java | 5 +----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
index 4ab9188..54e475b 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.33.2.6 2010/05/01 16:52:34 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.33.2.7 2010/10/16 00:39:45 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2083,9 +2083,11 @@ public abstract class AbstractJdbc2DatabaseMetaData
public java.sql.ResultSet getSchemas() throws SQLException
{
String sql;
+ // Show only the users temp schemas, but not other peoples
+ // because they can't access any objects in them.
if (connection.haveMinimumServerVersion("7.3"))
{
- sql = "SELECT nspname AS TABLE_SCHEM FROM pg_catalog.pg_namespace WHERE nspname <> 'pg_toast' AND nspname !~ '^pg_temp_' ORDER BY TABLE_SCHEM";
+ sql = "SELECT nspname AS TABLE_SCHEM FROM pg_catalog.pg_namespace WHERE nspname <> 'pg_toast' AND (nspname !~ '^pg_temp_' OR nspname = (pg_catalog.current_schemas(true))[1]) AND (nspname !~ '^pg_toast_temp_' OR nspname = replace((pg_catalog.current_schemas(true))[1], 'pg_temp_', 'pg_toast_temp_')) ORDER BY TABLE_SCHEM";
}
else
{
diff --git a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
index b6ba861..fb34975 100644
--- a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+++ b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.36.2.2 2008/11/07 09:12:01 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.36.2.3 2010/10/16 00:39:45 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -477,9 +477,6 @@ public class DatabaseMetaDataTest extends TestCase
public void testSchemas() throws Exception
{
- if (!TestUtil.haveMinimumServerVersion(con, "7.3"))
- return ;
-
DatabaseMetaData dbmd = con.getMetaData();
assertNotNull(dbmd);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git
More information about the pkg-java-commits
mailing list