[libpostgresql-jdbc-java] 09/10: 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:51 UTC 2017


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

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

commit 1543ab1d0149b05f965e82cd45a4a9f1278f7bed
Author: Kris Jurka <books at ejurka.com>
Date:   Sat Apr 2 11:43:31 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 8c92482..2ef59d6 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.44.2.5 2010/10/16 00:39:27 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.44.2.6 2010/12/22 16:54:18 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