Bug 1353210

Summary: Internal Server Error on ShowProfile page
Product: [Community] Spacewalk Reporter: unix
Component: ServerAssignee: Gennadii Altukhov <galtukho>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: high    
Version: 2.5CC: eherget, galtukho, ggainey, pstudeni
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1395879 (view as bug list) Environment:
Last Closed: 2017-09-27 19:13:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1395879, 1484117    

Description unix 2016-07-06 14:22:34 UTC
Description of problem:
Spacewalk throws an error when you try and view a systems package profile
javax.servlet.ServletException: com.redhat.rhn.common.db.WrappedSQLException: ORA-00904: "SUBSTRING": invalid identifier. 


Version-Release number of selected component (if applicable):
2.5

How reproducible:
Always

Steps to Reproduce:
1. View a systems profile
System -> Software -> Packages -> Profile


Actual results:
ISE 

Expected results:
A list of installed packages

Additional info:
Running on CentOS 6 with Oracle 11g

Catalina logs show
2016-07-06 09:26:03,398 [TP-Processor12] ERROR com.redhat.rhn.common.db.datasource.CachedStatement - Error while processing cached statement sql: SELECT S.id, S.name
  FROM rhnServer S,
       rhnServer SBase
 WHERE S.org_id = SBase.org_id
   AND SBase.id = ?
   AND EXISTS (SELECT 1 FROM rhnUserServerPerms WHERE user_id = ? AND server_id = S.id)
   AND S.server_arch_id = SBase.server_arch_id
   AND SUBSTRING(S.release, '^[0-9]+') = SUBSTRING(SBase.release, '^[0-9]+')
   AND S.id != ?
   AND EXISTS(SELECT 1 FROM rhnServerFeaturesView SFV WHERE SFV.server_id = S.id AND SFV.label = 'ftr_profile_compare')
ORDER BY UPPER(S.name)
com.redhat.rhn.common.db.WrappedSQLException: ORA-00904: "SUBSTRING": invalid identifier

Here is the commit that introduced this change
https://github.com/spacewalkproject/spacewalk/commit/0420e50fa4fcd819b8c99ca28682a1a0f1fae621

Comment 1 Grant Gainey 2016-07-06 15:32:45 UTC
SUBSTRING(str, regex) is postgres-only and fails on Oracle - we need to find a different, cross-db, way to accomplish this

Comment 2 Gennadii Altukhov 2016-07-07 14:27:41 UTC
Taking...

Comment 3 Gennadii Altukhov 2016-07-07 15:37:38 UTC
spacewalk.git:
408042f83c59fec4ff4095d2ad0512898244a509

Comment 4 Pavel Studeník 2016-11-10 16:12:28 UTC
Problem only on Oracle.

Reproducer by #Description
spacewalk-java-oracle-2.5.98-1.el6.noarch
spacewalk-java-2.5.98-1.el6.noarch

Verified with 
spacewalk-java-oracle-2.6.47-1.el7.noarch
spacewalk-java-2.6.47-1.el7.noarch

Comment 5 Eric Herget 2017-09-27 19:13:58 UTC
Spacewalk 2.7 has been released.

https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes27