Re: Bug in postgresql7.1 jdbc2 DatabaseMetaData class - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: Bug in postgresql7.1 jdbc2 DatabaseMetaData class
Date
Msg-id 200106041339.f54DdW007655@candle.pha.pa.us
Whole thread Raw
In response to Bug in postgresql7.1 jdbc2 DatabaseMetaData class  (Robert Weiler <rweiler@perfectsense.com>)
List pgsql-bugs
I see your fix in the current sources so we should be OK:

    tuple[0] = null;        // Catalog name
    tuple[1] = null;        // Schema name
    tuple[2] = r.getBytes(1);   // Table name
    tuple[3] = (relKind==null) ? null : relKind.getBytes(); // Table type
    tuple[4] = remarks;     // Remarks
    v.addElement(tuple);

> On line 1707 there is a dereference of 'relKind' which may very likely
> be set to null. This can cause a null pointer exception. I've include
> dthe workaround I am using, though there is almost certainly somethig
> better.
>
> Bob Weiler
>
> String relKind;
>     switch (r.getBytes(3)[0]) {
>     case 'r':
>         relKind = "TABLE";
>         break;
>     case 'i':
>         relKind = "INDEX";
>         break;
>     case 'S':
>         relKind = "SEQUENCE";
>         break;
>     default:
>         relKind = null;
>     }
>
>     tuple[0] = null;        // Catalog name
>     tuple[1] = null;        // Schema name
>     tuple[2] = r.getBytes(1);    // Table name
>     tuple[3] = relKind != null ? relKind.getBytes() : null;    // Table type
>     tuple[4] = remarks;        // Remarks
>     v.addElement(tuple);
>       }
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>

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

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: psql dumps core on \d command (7.1.1)
Next
From: Bruce Momjian
Date:
Subject: Re: bug in (plpgsql) parser?