Re: A bug fix for JDBC's getTables() in Postgresql 7.1

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Panu Outinen <panu(at)vertex(dot)fi>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: A bug fix for JDBC's getTables() in Postgresql 7.1
Date: 2001-05-16 16:41:37
Message-ID: 200105161641.f4GGfb414713@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc


Thanks. Patch applied to jdbc1 and jdbc2, and attached. I had already
patched the ORDER BY as:

sql.append("' order by relkind, relname");

> 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!
> -----
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Attachment Content-Type Size
unknown_filename text/plain 2.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Buttafuoco 2001-05-16 16:53:33 Running config vars
Previous Message Lamar Owen 2001-05-16 16:22:43 Re: Configurable path to look up dynamic libraries

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2001-05-16 16:48:37 Re: AGAIN: still no answer ... peter, or anybody knowledgeable, please ....
Previous Message Bruce Momjian 2001-05-16 16:31:26 Re: A Bug Fix - Is this a real bug? Has this already been fixed?