Bug 905872 - SW1.8 on pgsql: Errata search by CVE fails
SW1.8 on pgsql: Errata search by CVE fails
Product: Spacewalk
Classification: Community
Component: Server (Show other bugs)
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Tomas Lestach
Red Hat Satellite QA List
Depends On:
Blocks: space19
  Show dependency treegraph
Reported: 2013-01-30 06:12 EST by pierre.casenove
Modified: 2013-03-06 13:35 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-03-06 13:35:19 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description pierre.casenove 2013-01-30 06:12:55 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
redstone.xmlrpc.XmlRpcFault: redstone.xmlrpc.XmlRpcFault:
--- 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

How reproducible:
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#
Comment 1 Jan Pazdziora 2013-02-01 11:05:50 EST
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
Comment 2 Jan Pazdziora 2013-02-01 11:12:34 EST
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áš?
Comment 3 Tomas Lestach 2013-02-04 04:44:13 EST
Changing Map<String, String> to Map<String, Object> is the preferred way.
Jan, thank you for the great investigation!

spacewalk.git: 8d61315e4d1f4daced19660ac7aa1acb407766a4
Comment 4 Stephen Herr 2013-03-01 12:07:47 EST
Marking bug as ON_QA since tonight's build of Spacewalk nightly is a release candidate for Spacewalk 1.9.
Comment 5 Stephen Herr 2013-03-06 13:35:19 EST
Spacewalk 1.9 has been released.


Note You need to log in before you can comment on or make changes to this bug.