[libpostgresql-jdbc-java] 02/15: Fix DatabaseMetaData.getColumns for 7.2 servers. The change to use a window function to get the column position ended up breaking the query for ancient servers.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:55 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 efc4cf7ac38ad4f9a88e8acea90983330fdf3952
Author: Kris Jurka <books at ejurka.com>
Date:   Tue Aug 10 19:46:19 2010 +0000

    Fix DatabaseMetaData.getColumns for 7.2 servers.  The change to
    use a window function to get the column position ended up breaking
    the query for ancient servers.
---
 org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
index ca5a47a..59b1fa8 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.3 2009/12/09 01:06:41 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.51.2.4 2010/05/01 16:52:23 jurka Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -2310,7 +2310,7 @@ public abstract class AbstractJdbc2DatabaseMetaData
             }
 
             if (connection.haveMinimumServerVersion("8.4"))
-                sql += ") v WHERE true ";
+                sql += ") c WHERE true ";
 
         }
         else if (connection.haveMinimumServerVersion("7.2"))
@@ -2343,13 +2343,13 @@ public abstract class AbstractJdbc2DatabaseMetaData
 
         if (!connection.haveMinimumServerVersion("7.3") && tableNamePattern != null && !"".equals(tableNamePattern))
         {
-            sql += " AND relname LIKE '" + escapeQuotes(tableNamePattern) + "' ";
+            sql += " AND c.relname LIKE '" + escapeQuotes(tableNamePattern) + "' ";
         }
         if (columnNamePattern != null && !"".equals(columnNamePattern))
         {
             sql += " AND attname LIKE '" + escapeQuotes(columnNamePattern) + "' ";
         }
-        sql += " ORDER BY nspname,relname,attnum ";
+        sql += " ORDER BY nspname,c.relname,attnum ";
 
         ResultSet rs = connection.createStatement().executeQuery(sql);
         while (rs.next())

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