Mark Williams 14 Posted April 24, 2019 (edited) 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; Edited April 24, 2019 by Mark Williams Update Share this post Link to post
David Schwartz 426 Posted April 25, 2019 ExtendedMetaData slows things WAAAAAAAAAAYYYYYYYYYYYYY down! Don't enable it unless you absolutely need it! (I'm using PgDAC components, and we traced this into an auto-generated second query that is issued to the server after every query to get metadata for the previous query, and it runs slower than molasses in winter! We couldn't figure out why, but we just set the component to generate V2 queries rather than V3 queries to always suppress the metadata inquiry. Otherwise, you have to do it on each query you issue. But again, that's PgDAC.) Share this post Link to post
Mark Williams 14 Posted April 25, 2019 That's good to know. Thanks. Have you any experience of Batchmove and reverse inrements? Share this post Link to post
David Schwartz 426 Posted April 25, 2019 6 hours ago, Mark Williams said: That's good to know. Thanks. Have you any experience of Batchmove and reverse inrements? no, sorry. Share this post Link to post
João Gabriel 0 Posted March 29, 2021 getting a similar problem. But batchmove is actually trying to get the values from other fields, rather than going negative. =( Share this post Link to post