If the DB function that regenerates the hold-copy maps for a hold
receives duplicate copies in its second parameter, it blows up. This
commit prevents that by making the list unique at use time.
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Jason Stephenson <jason@sigio.com>
action.hold_request_regen_copy_maps(
hold_id INTEGER, copy_ids INTEGER[]) RETURNS VOID AS $$
DELETE FROM action.hold_copy_map WHERE hold = $1;
- INSERT INTO action.hold_copy_map (hold, target_copy) SELECT $1, UNNEST($2);
+ INSERT INTO action.hold_copy_map (hold, target_copy) SELECT DISTINCT $1, UNNEST($2);
$$ LANGUAGE SQL;
CREATE TABLE action.transit_copy (
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION
+ action.hold_request_regen_copy_maps(
+ hold_id INTEGER, copy_ids INTEGER[]) RETURNS VOID AS $$
+ DELETE FROM action.hold_copy_map WHERE hold = $1;
+ INSERT INTO action.hold_copy_map (hold, target_copy) SELECT DISTINCT $1, UNNEST($2);
+$$ LANGUAGE SQL;
+
+COMMIT;