A bug fix for JDBC's getTables() in Postgresql 7.1 - Mailing list pgsql-jdbc

From Panu Outinen
Subject A bug fix for JDBC's getTables() in Postgresql 7.1
Date
Msg-id 5.0.2.1.0.20010503181640.04b845e0@vertex.fi
Whole thread Raw
Responses A bug with pgsql 7.1/jdbc and non-ascii (8-bit) chars?  (Jani Averbach <jaa@cc.jyu.fi>)
Re: A bug fix for JDBC's getTables() in Postgresql 7.1  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-jdbc
Hi !!

I was trying to get a very nice FREE graphical db tool called DbVisualizer
(http://www.ideit.com/products/dbvis/) to work with Postgresql and I found
out the following bug: if database has views then getTables() gets the null
pointer exception ('order by relname' makes the listing tree in
DbVisualizer a lot useful !!)

This patch should propably be applied to the the jdbc1's
DatabaseMetaData.java, too.

[/tmp/postgresql-7.1/src/interfaces/jdbc/org/postgresql/jdbc2]$
<ql/jdbc2]$ diff -u DatabaseMetaData.java.org DatabaseMetaData.java

--- DatabaseMetaData.java.org    Wed May 02 22:52:25 2001
+++ DatabaseMetaData.java    Wed May 02 23:07:19 2001
@@ -1666,7 +1666,7 @@
      // Now take the pattern into account
      sql.append(") and relname like '");
      sql.append(tableNamePattern.toLowerCase());
-    sql.append("'");
+    sql.append("' order by relname");

      // Now run the query
      r = connection.ExecSQL(sql.toString());
@@ -1697,6 +1697,9 @@
      case 'S':
          relKind = "SEQUENCE";
          break;
+    case 'v':
+        relKind = "VIEW";
+        break;
      default:
          relKind = null;
      }
@@ -1704,7 +1707,7 @@
      tuple[0] = null;        // Catalog name
      tuple[1] = null;        // Schema name
      tuple[2] = r.getBytes(1);    // Table name
-    tuple[3] = relKind.getBytes();    // Table type
+    tuple[3] = (relKind==null) ? null : relKind.getBytes();    // Table type
      tuple[4] = remarks;        // Remarks
      v.addElement(tuple);
        }


-----
http://www.ideit.com/products/dbvis/

...

DbVisualizer
Version: 2.0
Released: 2001-04-20


The #1 requested feature to ease editing table data is now supported!
The #2 requested feature to print graphs is now supported!
Read the complete change log for all new features and enhancements!


DbVisualizer is a cross platform database visualization and edit tool
relying 100% on the JDBC, Java Database Connectivity API's. DbVisualizer
enables simultaneous connections to many different databases through JDBC
drivers available from a variety of vendors. Just point and click to browse
the structure of the database, characteristics of tables, etc. No matter if
it's an enterprise database from Oracle or an open source product like
InstantDB!

And best of all -> it's FREE!
-----



pgsql-jdbc by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Returning oid or primary key
Next
From: "Jerry Reid"
Date:
Subject: Unable to store SHA hash