IDEMPIERE-730 03_update_sequences.sql for native sequence / improve performance

This commit is contained in:
Carlos Ruiz 2019-08-26 17:53:48 +02:00
parent 23e6325afc
commit a9fb26e58d
1 changed files with 7 additions and 4 deletions

View File

@ -111,13 +111,16 @@ BEGIN
|| ' where name='''
|| r.tablename
|| ''' and istableid=''Y''';
EXECUTE cmdupd;
END IF;
IF currentseq < currentnext AND isnativeseqon ='Y' THEN
WHILE NOT currentseq >= (currentnext-1) LOOP
EXECUTE 'SELECT nextval('''||trim(r.tablename)||'_sq'''||')' INTO currentseq;
END LOOP;
cmdupd :=
'SELECT setval('''
|| trim(r.tablename)
|| '_sq'','
|| currentnext
|| ')';
EXECUTE cmdupd;
END IF;
END IF;
END LOOP;