From 83feff3ee70266c9936b512cbbf80c2605ac86ba Mon Sep 17 00:00:00 2001
From: Dave Cramer <davec@fastcrypt.com>
Date: Fri, 20 Dec 2002 13:15:53 +0000
Subject: [PATCH] patch for null table in getPrimaryKeys

---
 .../postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
index 00a9bee46bf..02798897ad1 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
@@ -2903,9 +2903,11 @@ public abstract class AbstractJdbc1DatabaseMetaData
 			" ci.relname AS PK_NAME "+
 			from+
 			" WHERE ct.oid=i.indrelid AND ci.oid=i.indexrelid "+
-			" AND a.attrelid=ci.oid AND i.indisprimary "+
-			" AND ct.relname = '"+escapeQuotes(table)+"' "+
-			where+
+			" AND a.attrelid=ci.oid AND i.indisprimary ";
+                        if (table != null && !"".equals(table)) {
+			        sql += " AND ct.relname = '"+escapeQuotes(table)+"' ";
+                        }
+			sql += where+
 			" ORDER BY table_name, pk_name, key_seq";
 		return connection.createStatement().executeQuery(sql);
 	}
-- 
GitLab