From d5c238f0b62c745cedc6029edc04e2ec7076e4f5 Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Wed, 12 Sep 2012 08:09:57 +0000
Subject: [PATCH] BIS-180 - openBIS AS becomes unresponsive when performing
 batch sample updates - fix the sample_type.is_subcode_unique consistency only
 for sample types with this flag set to true

SVN: 26605
---
 openbis/source/sql/postgresql/migration/migration-119-120.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openbis/source/sql/postgresql/migration/migration-119-120.sql b/openbis/source/sql/postgresql/migration/migration-119-120.sql
index 3945b41883d..db787144d7b 100644
--- a/openbis/source/sql/postgresql/migration/migration-119-120.sql
+++ b/openbis/source/sql/postgresql/migration/migration-119-120.sql
@@ -96,7 +96,7 @@ DECLARE
   sample_count INTEGER; 
 BEGIN
   
-    FOR sample_type_record IN SELECT * FROM sample_types LOOP
+    FOR sample_type_record IN SELECT * FROM sample_types WHERE is_subcode_unique = true LOOP
         select count(*) as c into sample_count from samples_all where saty_id = sample_type_record.id group by code, saty_id, space_id, dbin_id order by c desc limit 1;
         IF (sample_count > 1) THEN
           update sample_types set is_subcode_unique = false where id = sample_type_record.id;     
-- 
GitLab