Bug 675912

Summary: table or view does not exist - syntax error in sql statement
Product: [Community] Spacewalk Reporter: Terry Smith <t.smith>
Component: ServerAssignee: Michael Mráka <mmraka>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.3CC: tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: spacewalk-backend-1.4.6-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-26 09:10:41 UTC Type: ---
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: 674675    

Description Terry Smith 2011-02-08 08:46:06 UTC
Description of problem:

When running rhn_check on a registered system the command reported that it failed due to a server error and emailed the RHN TRACEBACK below.

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

SpaceWalk v1.3

How reproducible:


Steps to Reproduce:
1. execute rhn_check from a registered server.
2.
3.
  
Actual results:

RHN TRACEBACK...
Exception reported from aaf-test1
Time: Tue Feb  8 18:32:40 2011
Exception type spacewalk.server.rhnSQL.sql_base.SQLStatementPrepareError
Exception while handling function queue.get
Request object information:
URI: /XMLRPC
Remote Host: 192.43.207.20
Server Name: 127.0.0.1:0
Headers passed in:
       Accept-Encoding: identity
       Content-Length: 2723
       Host: mgnt.exp.aaf.edu.au
       content-type: text/xml
       user-agent: rhn.rpclib.py/$Revision$
       x-client-version: 1
       x-info: RPC Processor (C) Red Hat, Inc (version $Revision$)
       x-rhn-client-capability: packages.verifyAll(1)=1,caneatCheese(1)=1,packages.extended_profile(2)=1,reboot.reboot(1)=1,packages.verify(1)=1,packages.runTransaction(1)=1,packages.update(2)=2,packages.rollBack(1)=1,packages.verifyAll(1)=1,caneatCheese(1)=1,packages.extended_profile(2)=1,reboot.reboot(1)=1,packages.verify(1)=1,packages.runTransaction(1)=1,packages.update(2)=2,packages.rollBack(1)=1
       x-rhn-transport-capability: follow-redirects=3
       x-transport-info: Extended Capabilities Transport (C) Red Hat, Inc (version $Revision$)
       x-up2date-version: 1.2.15-1.el5
Extra information about this error:
SQL Error generated: ('ORA-00942: table or view does not exist\n', 942, 'select distinct pn.name as name, pe.version as version, pe.release as release, pe.epoch as epoch, pa.label as arch from rhnActionPackage ap, left join rhnPackageArch pa on ap.package_arch_id = pa.id, rhnPackageName pn, rhnPackageEVR pe where ap.action_id = :actionid and ap.evr_id = pe.id and ap.name_id = pn.id')

Exception Handler Information
Traceback (most recent call last):
 File "/usr/lib/python2.4/site-packages/spacewalk/server/apacheRequest.py", line 118, in call_function
   response = apply(func, params)
 File "/usr/share/rhn/server/handlers/xmlrpc/queue.py", line 326, in get
   ret = self.__getV2(action)
 File "/usr/share/rhn/server/handlers/xmlrpc/queue.py", line 84, in __getV2
   result = method(self.server_id, action['id'], dry_run)
 File "/usr/lib/python2.4/site-packages/spacewalk/server/action/packages.py", line 51, in verify
   h.execute(actionid=actionId)
 File "/usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 163, in execute
   return apply(self._execute_wrapper, (self._execute, ) + p, kw)
 File "/usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/driver_cx_Oracle.py", line 107, in _execute_wrapper
   raise apply(sql_base.SQLStatementPrepareError, args)
SQLStatementPrepareError: ('ORA-00942: table or view does not exist\n', 942, 'select distinct pn.name as name, pe.version as version, pe.release as release, pe.epoch as epoch, pa.label as arch from rhnActionPackage ap, left join rhnPackageArch pa on ap.package_arch_id = pa.id, rhnPackageName pn, rhnPackageEVR pe where ap.action_id = :actionid and ap.evr_id = pe.id and ap.name_id = pn.id')

Local variables by frame
Frame _execute_wrapper in /usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/driver_cx_Oracle.py at line 107
                   function = <type 'instancemethod'> <bound method Cursor._execute of <__builtin__.OracleCursor on <cx_Oracle.Connection to wp@XE>>>
                          e = <type 'instance'> ORA-00942: table or view does not exist

                      errno = <type 'int'> 942
                       self = <type 'instance'> <__builtin__.OracleCursor on <cx_Oracle.Connection to wp@XE>>
                       args = <type 'tuple'> (942, 'ORA-00942: table or view does not exist\n', 'select distinct pn.name as name, pe.version as version, pe.release as release, pe.epoch as epoch, pa.label as arch from rhnActionPackage ap, left join rhnPackageArch pa on ap.package_arch_id = pa.id, rhnPackageName pn, rhnPackageEVR pe where ap.action_id = :actionid and ap.evr_id = pe.id and ap.name_id = pn.id')
            modified_params = <type 'list'> []
                      value = <type 'int'> 71
                          p = <type 'tuple'> ()
                     params = <type 'str'> 'actionid': 71
                        ret = <type 'tuple'> (942, 'ORA-00942: table or view does not exist\n', 'select distinct pn.name as name, pe.version as version, pe.release as release, pe.epoch as epoch, pa.label as arch from rhnActionPackage ap, left join rhnPackageArch pa on ap.package_arch_id = pa.id, rhnPackageName pn, rhnPackageEVR pe where ap.action_id = :actionid and ap.evr_id = pe.id and ap.name_id = pn.id')
                        key = <type 'str'> actionid
                         kw = <type 'dict'> {'actionid': 71}
                     errmsg = <type 'str'> ORA-00942: table or view does not exist

...

Expected results:

rhn_check should complete without error.

Additional info:

There is a Syntax error in the SQL statement, line 39 of package.py in the directory /usr/lib/python2.4/site-packages/spacewalk/server/action.

_query_action_verify_packages = rhnSQL.Statement("""
  select distinct
           pn.name as name,
           pe.version as version,
           pe.release as release,
           pe.epoch as epoch,
           pa.label as arch
      from rhnActionPackage ap, /*** This comma is not valid ***/
 left join rhnPackageArch pa
        on ap.package_arch_id = pa.id,
           rhnPackageName pn,
           rhnPackageEVR pe
     where ap.action_id = :actionid
       and ap.evr_id = pe.id
       and ap.name_id = pn.id
""")

The comma(,) that appear at the end of from and before left causes the SQL statement to fail. Removing this comma resolves the problem.

Thanks.

Comment 1 Michael Mráka 2011-02-08 14:08:01 UTC
Fixed by
commit 002d4d9e172334d3e791c9469a52801871349072
    675912 - fixed typo
    introduced in 6aa980ce46e59e4a7de40bcfe6a5c2dfa87b92d7

Will be fixed in spacewalk-backend-1.4.6-1.

Comment 2 Miroslav Suchý 2011-04-11 07:45:13 UTC
Mass moving to ON_QA before release of Spacewalk 1.4

Comment 3 Miroslav Suchý 2011-04-26 09:10:41 UTC
Spacewalk 1.4 has been released