Bug 1274583

Summary: DB migration from 5.2.0@embOracle to 5.7.0@embPostgreSQL fails on import step: psql:<stdin>:10773: ERROR: more than one row returned by a subquery used as an expression
Product: Red Hat Satellite 5 Reporter: Jan Hutař <jhutar>
Component: UpgradesAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED ERRATA QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 570CC: adujicek, dyordano, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhn-upgrade-5.7.0.29-1-sat Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-28 11:15: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:

Description Jan Hutař 2015-10-23 04:40:31 UTC
Description of problem:
I'm getting error when importing dump from 5.2.1 on 5.7.0.


Version-Release number of selected component (if applicable):
Source 5.2.1 satellite:
  rhn-satellite-schema-5.2.0-8.el5
  rhn-upgrade-5.7.0.26-1.el5sat
Target 5.7.0 satellite:
  satellite-schema-5.7.0.19-1.el6sat.noarch
  package rhn-upgrade is not installed   <- is this a problem? IMO should not be important in import step (see below)


How reproducible:
always


Steps to Reproduce:
1. Install Satellite 5.2.1
2. 5.2.1# yum -y install rhn-upgrade 
3. 5.2.1# service rhn-satellite stop; service rhn-database start
4. 5.2.1# cd /etc/sysconfig/rhn/satellite-upgrade/scripts; ./spacewalk-dump-schema | bzip2 -7c - | split -d -b 2147483648 - backup
5. Install Satellite 5.7.0 and transfer a dump to it
6. 5.7.0# rhn-satellite stop; db-control start
7. 5.7.0# (cat /tmp/backup* | bzcat | spacewalk-sql --verbose --select-mode-direct - && echo "Schema import finished successfully") 2>&1 | tee /var/log/rhn/rhn-schema-import.log


Actual results:
Step "7." fails with:
[...]
UPDATE 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
psql:<stdin>:10773: ERROR:  more than one row returned by a subquery used as an expression

In the PostgreSQL log:

2015-10-22 17:24:00.466 EDT ERROR:  more than one row returned by a subquery used as an expression
2015-10-22 17:24:00.466 EDT STATEMENT:  INSERT INTO rhnTaskoSchedule (id, job_label, bunch_id, active_from, cron_expr)
            VALUES(sequence_nextval('rhn_tasko_schedule_id_seq'), 'reboot-action-cleanup-default',
                (SELECT id FROM rhnTaskoBunch WHERE name='reboot-action-cleanup-bunch'),
                current_timestamp, '0 0 * * * ?');


Expected results:
It should work.


Additional info:
We have seen something similar in bug 1262348, bit that was for /usr/bin/spacewalk-dump-schema and no upgrade involved, this is for /etc/sysconfig/rhn/satellite-upgrade/scripts/spacewalk-dump-schema and involves upgrade.

Comment 9 errata-xmlrpc 2016-04-28 11:15:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0698.html