#321 NPE in indexes tab

2.1rc2
closed-wont-fix
Core (462)
5
2005-12-08
2005-12-07
No

Hi, when viewing a table in the treeview, if I go in
the "indexes" tab there is a NullPointerException if
the table has no indexes and no primary key. I'm using
Postgres 7.2 but I think this would happens on any database

Discussion

  • Rob Manning

    Rob Manning - 2005-12-07

    Logged In: YES
    user_id=1287991

    Hello,

    I use PostgreSQL 8.0.3 and click on the Indexes tab when
    I select a table in the object tree. I don't seem to get
    an NPE, just an empty table (My table doesn't have any
    indexes defined). Could you look in you squirrel-sql.log
    (<user.home>/.squirrel-sql/logs/squirrel-sql.log) and post
    your stack trace? (Or just attach the log file if you are
    not sure)

    Rob Manning

     
  • Rob Manning

    Rob Manning - 2005-12-07
    • labels: --> Core
    • assigned_to: nobody --> manningr
     
  • Matthieu Casanova

    Logged In: YES
    user_id=285591

    Hi, the exception was not in the logs so I recompiled the
    last CVS version of squirrelsql and I have now the exception

    java.lang.RuntimeException: java.lang.NullPointerException
    at
    net.sourceforge.squirrel_sql.fw.util.TaskThreadPool$MyCallback$1.run(TaskThreadPool.java:118)
    at
    java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at
    net.sourceforge.squirrel_sql.client.Application$1.dispatchEvent(Application.java:172)
    at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at
    java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Caused by: java.lang.NullPointerException
    at org.postgresql.jdbc2.ResultSet.getBytes(ResultSet.java:321)
    at
    org.postgresql.jdbc2.DatabaseMetaData.getIndexInfo(DatabaseMetaData.java:2942)
    at
    net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData.getIndexInfo(SQLDatabaseMetaData.java:1531)
    at
    net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.table.IndexesTab.createDataSet(IndexesTab.java:77)
    at
    net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.BaseDataSetTab$1.run(BaseDataSetTab.java:123)
    at
    net.sourceforge.squirrel_sql.fw.util.TaskExecuter.run(TaskExecuter.java:82)
    at java.lang.Thread.run(Thread.java:595)

    This may be a bug in the postgres jdbc driver. I tried to
    debug and here is what I found :
    In SQLDatabaseMetaData line 1531:
    rs = privateGetJDBCMetaData().getIndexInfo(
    ti.getCatalogName(), ti.getSchemaName(),
    ti.getSimpleName(), false, true);

    the parameters are always
    rs = privateGetJDBCMetaData().getIndexInfo(null, null,
    TABLENAME, false, true);

    with some tables it throws a NPE but with others it works
    fine so I'm not sure you could do something about it ...

     
  • Rob Manning

    Rob Manning - 2005-12-08

    Logged In: YES
    user_id=1287991

    I don't believe that we can do anything about this. It's
    definitely a bug in the driver - you might want to file a
    bug report with PostgreSQL, if they don't have a later
    version of the driver that fixes the issue. The call to
    DBMD.getIndexInfo(...) with the parameters you cited seems
    like a perfectly reasonable thing to do to build the indexes
    table.

    Rob Manning

     
  • Rob Manning

    Rob Manning - 2005-12-08
    • milestone: --> 2.1rc2
    • status: open --> closed-wont-fix
     
  • Matthieu Casanova

    Logged In: YES
    user_id=285591

    Ok, I could fill a bug report in the driver but it's an old
    driver for postgres 7.2 (but the last one for this old
    postgres's release) so I'm not sure they will try to fix it

     

Log in to post a comment.