Bug 705002

Summary: rhnreg_ks after kickstart install fails with PG backend
Product: [Community] Spacewalk Reporter: Julian Einwag <je>
Component: ServerAssignee: Michael Mráka <mmraka>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.5   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-backend-1.5.24-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-21 14:43:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 695242    
Attachments:
Description Flags
Makes the query PostgreSQL compatible but will break Oracle compatibility.
none
Query should now work with both PostgreSQL and Oracle none

Description Julian Einwag 2011-05-16 10:54:09 UTC
rhnreg_ks after kickstart install fails with PG backend due to an incompatible SQL query in backend/server/rhnAction.py (line 40):

    insert into rhnAction 
               (id, org_id, action_type, name, scheduler, earliest_action, prerequisite)
        values (:action_id, :org_id, :action_type_id, :action_name, :scheduler, 
                sysdate + :delta / 86400, :prerequisite) 

Sysdate does not work with PostgreSQL.

Comment 1 Julian Einwag 2011-05-17 08:57:30 UTC
Created attachment 499288 [details]
Makes the query PostgreSQL compatible but will break Oracle compatibility.

Comment 2 Michael Mráka 2011-05-17 09:58:31 UTC
Hi Julian,

did you consult PostgreSQL Porting Guide on our wiki? There is a couple of similar fixes so you might find out more appropriate fix there - https://fedorahosted.org/spacewalk/wiki/PostgreSQLPortingGuide#Datearithmetics

Regards,
Michael

Comment 3 Julian Einwag 2011-05-17 10:46:29 UTC
Created attachment 499302 [details]
Query should now work with both PostgreSQL and Oracle

Hi Michael,

thanks for the hint. I changed the query again so that it should work with both PostgreSQL and Oracle, though I currently don't have an Oracle installation available for testing.

Best regards,
Julian

Comment 4 Michael Mráka 2011-05-17 11:19:27 UTC
I did a quick check...
current_timestamp + interval ':delta' second  doesn't work in oracle, 
current_timestamp + numtodsinterval(:delta, 'second')  works both in oracle and PG.

Comment 5 Michael Mráka 2011-05-19 08:51:13 UTC
Fixed in spacewalk master as
commit 7d3571ed25b8c9e4b6855e7776ebd72c3faff005
    705002 - made query pg compatible

Comment 6 Jan Pazdziora 2011-07-19 19:36:47 UTC
This bugzilla is currently MODIFIED, so we believe the fix is in the Spacewalk nightly yum repository at http://spacewalk.redhat.com/yum/nightly/

Therefore, moving ON_QA.

Comment 7 Jan Pazdziora 2011-07-21 14:43:34 UTC
Spacewalk 1.5 was released.