I get an NPE sometimes when I select from certain tables or functions.
This is what the .metadata/.log looks like when it happens:
!ENTRY net.sourceforge.sqlexplorer 4 4 2012-08-06 17:04:09.062
!MESSAGE Error executing.
After seeing the above exception, I tried messing around with History settings - different retentions, number of files, and that sort of thing - and it didn't make a difference. I usually configure it to retain all my queries forever.
I have a specific table that it does this on every time when I do a 'select * from mytable'. It does not NPE if I select every column in the table ( 'select a, b, c, d from mytable'.) The Preview window works fine for that table. It does not do it for 'select *' on other tables. I have a copy of this table in an Oracle 10G database and a PostgreSQL 9.1 database. It does it for both database back ends.
I don't believe there are any strange characters in that table (if so, I'd expect to be able to get the NPE by selecting a specific column or row - that does not happen, it is only 'select *' that chokes).
I can't share the specific tables that it does this on. I have noticed it on several tables and several functions. I'm not sure how to reproduce it except against my live data.
Most of these PostgreSQL functions NPE in my copy of SQLExplorer - https://github.com/Peter2ndQuadrant/health-check (they used to work - this all started back in the late spring, after the 4/20 update). Those functions still work from the psql command line. They also work if I specify a column set instead of 'select *'.
I moved my history file out of the way, and ran the same query on the same database again and I did not get an NPE.
I'm wondering if it has something to do with the fact that I changed the Alias for several of my frequently used database connections. The history file still has the old aliases in it.
Using the empty history file, I ran a few queries until they had flushed to the SQLHistory.xml file.
Then I changed the alias for my database connection.
Then I tried to run the queries I had just run, and I got Null Pointer Exceptions.
The next thing I tried was go manually go through my SQLHistory.xml file and sync up all of the alias='' values with the <name> values in the SQLAliases.xml.
Now I can run queries that I couldn't before.
I'll keep in mind that whenever I change one of those names, I have to go in and manually update the History file.
Yes, that's a bug in SQLHistory if an alias is renamed or deleted. The alias is used to show on which alias the query was executed and to reopen it with the correct connection.
If the alias stored in history is gone this should be detected and the entry should be deleted or set to an 'unknow' alias.
I will fix this with next release.
Thanks for your investigations :-)
Log in to post a comment.