Description of problem:
upgrade script 03_03_0710_add_profile_to_network_interface.sql has the following code :
--START--
Create or replace FUNCTION __temp_has_port_mirroring_vm_interfaces(v_network_id UUID) RETURNS BOOLEAN
AS $procedure$
BEGIN
RETURN ((SELECT 1
FROM vm_interface
INNER JOIN vm_static
ON vm_static.vm_guid = vm_interface.vm_guid
INNER JOIN network_cluster
ON network_cluster.cluster_id = vm_static.vds_group_id
INNER JOIN network
ON network.id = network_cluster.network_id
AND network.name = vm_interface.network_name
WHERE network.id = v_network_id
AND port_mirroring = TRUE) IS NOT NULL);
END; $procedure$
LANGUAGE plpgsql;
--END--
When this function is called, it expects to return one value which is boolean.
On the attached database more than one row is returned and breaks the upgrade as you can see in the log:
psql:upgrade/03_03_0710_add_profile_to_network_interface.sql:80: ERROR: more than one row returned by a subquery used as an expression
CONTEXT: SQL statement "SELECT ((SELECT 1 FROM vm_interface INNER JOIN vm_static ON vm_static.vm_guid = vm_interface.vm_guid INNER JOIN network_cluster ON network_cluster.cluster_id = vm_static.vds_group_id INNER JOIN network ON network.id = network_cluster.network_id AND network.name = vm_interface.network_name WHERE network.id = $1 AND port_mirroring = TRUE) IS NOT NULL)"
PL/pgSQL function "__temp_has_port_mirroring_vm_interfaces" line 2 at RETURN
Version-Release number of selected component (if applicable):
How reproducible:
Steps to Reproduce:
1. Restore 3.3 database from attached file using pg_restore
2. Try to upgrade manually to 3.3 using upgrade.sh
3.
Actual results:
Upgrade fails with ERROR: more than one row returned by a subquery used as an expression
Expected results:
Upgrade should complete successfully
Additional info:
(In reply to Eli Mesika from comment #0)
sorry , should be:
Steps to Reproduce:
1. Restore 3.2 database from attached file using pg_restore
2. Try to upgrade manually to 3.3 using upgrade.sh
3.