seq_alters=""
for seq in $sequences; do
orgseqval=$(psql_query <<END
- SELECT start_value || ' ' || last_value FROM $seq
+ SELECT s.last_value FROM $seq s
END
)
- read orgstart orglast <<END
+ read orglast <<END
$orgseqval
END
newlast=$(( 10000 * (2 + $orglast / 10000) ))
seq_alters+="
ALTER SEQUENCE $seq
- START WITH $orgstart
+ START WITH $newlast
RESTART WITH $newlast;
"
done
# Schema should now be identical to main DB
$(withtest get_pgdump_cmd) -s -O -x >$t.schema.created
- diff -u $t.schema.orig $t.schema.created
+
+ for wh in orig created; do
+ perl -pe '
+ next unless m{^CREATE SEQUENCE }..m{^\)};
+ $_ = "" if m/^\s*START WITH \d+$/;
+ ' <$t.schema.$wh >$t.schema.$wh-laund
+ done
+
+ diff -u $t.schema.orig-laund $t.schema.created-laund
#---------- mark resources that we are going to borrow ----------