Postgres fix of post migration process to update sequences
This commit is contained in:
parent
9e781224ab
commit
c696064fc8
|
@ -25,7 +25,7 @@ BEGIN
|
||||||
cmdsys :=
|
cmdsys :=
|
||||||
'SELECT MAX ('
|
'SELECT MAX ('
|
||||||
|| r.tablename
|
|| r.tablename
|
||||||
|| '_id) currentnextsys FROM '
|
|| '_id) as currentnextsys FROM '
|
||||||
|| r.tablename
|
|| r.tablename
|
||||||
|| ' where '
|
|| ' where '
|
||||||
|| r.tablename
|
|| r.tablename
|
||||||
|
@ -46,15 +46,15 @@ BEGIN
|
||||||
currentnextsys := 0;
|
currentnextsys := 0;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT INTO currentnextsys DECODE (SIGN (currentnextsys - 50000),
|
SELECT INTO currentnextsys CASE SIGN (currentnextsys - 50000)
|
||||||
-1, 50000,
|
WHEN -1 THEN 50000
|
||||||
NVL (currentnextsys + 1, 50000)
|
ELSE coalesce (currentnextsys + 1, 50000)
|
||||||
);
|
END;
|
||||||
|
|
||||||
cmdnosys :=
|
cmdnosys :=
|
||||||
'SELECT MAX ('
|
'SELECT MAX ('
|
||||||
|| r.tablename
|
|| r.tablename
|
||||||
|| '_id) currentnext FROM '
|
|| '_id) as currentnext FROM '
|
||||||
|| r.tablename
|
|| r.tablename
|
||||||
|| ' where '
|
|| ' where '
|
||||||
|| r.tablename
|
|| r.tablename
|
||||||
|
@ -67,10 +67,10 @@ BEGIN
|
||||||
currentnext := 0;
|
currentnext := 0;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT INTO currentnext DECODE (SIGN (currentnext - 1000000),
|
SELECT INTO currentnext CASE SIGN (currentnext - 1000000)
|
||||||
-1, 1000000,
|
WHEN -1 THEN 1000000
|
||||||
NVL (currentnext + 1, 1000000)
|
ELSE coalesce (currentnext + 1, 1000000)
|
||||||
);
|
END ;
|
||||||
|
|
||||||
cmdseq :=
|
cmdseq :=
|
||||||
'SELECT currentnext, currentnextsys FROM AD_Sequence '
|
'SELECT currentnext, currentnextsys FROM AD_Sequence '
|
||||||
|
@ -101,4 +101,4 @@ $func$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
select update_sequences();
|
select update_sequences();
|
||||||
|
|
||||||
commit;
|
commit;
|
||||||
|
|
Loading…
Reference in New Issue