Red Hat Bugzilla – Bug 905872
SW1.8 on pgsql: Errata search by CVE fails
Last modified: 2013-03-06 13:35:19 EST
Description of problem:
Spacewalk raises an exception when trying to search an errata by CVE.
In the search field, I put the name of the CVE (for example CVE-2012-0611) and select "Search by CVE" but it fails with error "could not execute query".
In the catalina.out file, I've got the following error:
2013-01-23 16:32:27,138 [TP-Processor8] WARN com.redhat.rhn.frontend.action.errata.ErrataSearchAction - Performing errata search
--- The error occurred in com/redhat/satellite/search/db/errata_handler.xml.
--- The error occurred while applying a parameter map.
--- Check the listErrataByCVE-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: org.postgresql.util.PSQLException: ERROR: operator does not exist: numeric = character varying
Version-Release number of selected component (if applicable): SW 1.8
Go to errata search, select "Search by CVE", put the name of the CVE, hit "Search" button.
Actual results: Error page "could not execute query"
Expected results: corresponding errata should be listed
Additional info: When searching errata by issue date and not specifying anything in the search field, the same error occurs.
The requests in file errata_handler.xml seems to be postgresql incompatible on this part: ps.id = #sessionId#
I've tried to do
- ps.id = #sessionId# and
+ ps.id = #sessionId# + 0 and
but that gives me
org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying + integer
We can do
- args.put("sessionId", sessionId.toString());
+ args.put("sessionId", sessionId);
but that fails with
put(java.lang.String,java.lang.String) in java.util.Map<java.lang.String,java.lang.String> cannot be applied to (java.lang.String,java.lang.Long)
but we can change all the Maps from Map<String, String> to Map<String, Object> and that seems to work.
Or we could define compatibility SQL function to_number to take string and return number, along the lines of Oracle's
SQL> select to_number('123') from dual ;
Which approach do you prefer, Tomáš?
Changing Map<String, String> to Map<String, Object> is the preferred way.
Jan, thank you for the great investigation!
Marking bug as ON_QA since tonight's build of Spacewalk nightly is a release candidate for Spacewalk 1.9.
Spacewalk 1.9 has been released.