Has anyone been able to get the BatchMove component to work correctly with PostgreSQL in AppendUpdate mode where there is an auto inc key field?
My BatchMove component creation code is below.
In addition, either the FDConnectionPG ExtendedMetaData param is set to true or the FDQueryPG updateOptions.AutoIncFields is set. Either way produces the same result, although I understand there is an efficiency hit with use of ExtendedMetaData.
The problem is that whilst new rows get added to the table and my auto inc key field value gets set, it is running backwards ie -1, -2, -3 etc. Am I missing something or is this a bug?
var
FBatchMove: TFDBatchMove;
FReader: TFDBatchMoveDataSetReader;
FWriter: TFDBatchMoveSQLWriter;
F:TField;
begin
FBatchMove := TFDBatchMove.Create(nil);
FReader := TFDBatchMoveDataSetReader.Create(FBatchMove);
FWriter := TFDBatchMoveSQLWriter.Create(FBatchMove);
try
FReader.DataSet:=FDQueryPG;
FWriter.Connection:=FDConnectionPG;
FWriter.TableName:='dummy';
FBatchMove.CommitCount:=1000;
FBatchMove.Mode := dmAppendUpdate;
FBatchMove.options:=FBatchmove.Options+[poIdentityInsert];
FBatchMove.Execute;
finally
FWriter.Free;
FReader.Free;
FBatchMove.Free;
end;