-9,223,372,036,846,508,949
Is this a bug? Maybe the Format('ALTER SEQUENCE %s RESTART WITH %d;' is the problem? Maybe %d isn't big enough to accept such a large integer?
BIGINT is defined as -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)
So -9,223,372,036,846,508,949 should fit in a BIGINT.
But .AsInteger (which is used) is an integer in FPC. (B.T.W. in Delphi it is a LongInt but effectively the same on 32 bits)
So, yeah, that could be a problem.
Usually you would do .asInt64 for a BigInt.