[libpostgresql-jdbc-java] 14/15: Fix getSchemas for 7.3 servers. 7.3 cannot extract an array element from an array that is returned by a function. Instead coerce it to text and pull it out with a regex.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:57 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL8_4_703
in repository libpostgresql-jdbc-java.

commit e3e4eb1e23a2ed05cbb80af69933a66d979bffd8
Author: Kris Jurka <books at ejurka.com>
Date:   Sat Apr 2 11:43:22 2011 +0000

    Fix getSchemas for 7.3 servers.  7.3 cannot extract an array element
    from an array that is returned by a function.  Instead coerce it to
    text and pull it out with a regex.
---
 org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
index 1e1139c..907fc94 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2008, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.51.2.7 2010/10/23 07:31:00 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.51.2.8 2010/12/22 16:54:05 jurka Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -2149,7 +2149,11 @@ public abstract class AbstractJdbc2DatabaseMetaData
         // 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_' 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";
+            String tempSchema = "substring(textin(array_out(pg_catalog.current_schemas(true))) from '{(pg_temp_[0-9]+),')";
+            if (connection.haveMinimumServerVersion("7.4")) {
+                tempSchema = "(pg_catalog.current_schemas(true))[1]";
+            }
+            sql = "SELECT nspname AS TABLE_SCHEM FROM pg_catalog.pg_namespace WHERE nspname <> 'pg_toast' AND (nspname !~ '^pg_temp_' OR nspname = " + tempSchema + ") AND (nspname !~ '^pg_toast_temp_' OR nspname = replace(" + tempSchema + ", 'pg_temp_', 'pg_toast_temp_')) ORDER BY TABLE_SCHEM";
         }
         else
         {

-- 
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