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


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

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

commit 16d7a7d9068e0c791b7b2289e239077e866fcab8
Author: Kris Jurka <books at ejurka.com>
Date:   Sat Apr 2 11:43:16 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 7046393..ad169c1 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.57.2.2 2010/10/23 07:30:53 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.57.2.3 2010/12/22 16:53:56 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