imUpdateOrInsert PostgreSQL ?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
luapfr
Posts: 37
Joined: Thu 11 Apr 2013 13:11

imUpdateOrInsert PostgreSQL ?

Post by luapfr » Wed 16 Mar 2022 23:02

When setting the PostgreSQL Provider in TUniLoader
in SpecificOptions there is no option imUpdateOrInsert why ?

from what i know postgres has the command similar example :

INSERT INTO customers (name, email)
VALUES('Microsoft','[email protected]')
ON CONFLICT (name)
DO
UPDATE SET email = EXCLUDED.email || ';' || customers.email;

evgeniym
Devart Team
Posts: 103
Joined: Thu 13 May 2021 07:08

Re: imUpdateOrInsert PostgreSQL ?

Post by evgeniym » Thu 17 Mar 2022 11:01

Hi there,

Thank you for contacting Devart!
TUniLoader uses the COPY command rather than INSERT to speed up data loading into PostgreSQL, because the COPY command is faster.
You can read more about TUniLoader at https://docs.devart.com/unidac/devart.u ... loader.htm
You can read about the COPY command at https://www.postgresql.org/docs/14/sql-copy.html

Regards,
Evgeniy

luapfr
Posts: 37
Joined: Thu 11 Apr 2013 13:11

Re: imUpdateOrInsert PostgreSQL ?

Post by luapfr » Thu 17 Mar 2022 14:45

I don't understand what you mean by ?
You can read about the COPY command at https://www.postgresql.org/docs/14/sql-copy.html
Is there any way to update TUniLoader with Postgres ?

If it exists as it is not mentioned in the documentation.
the fact is it's no use being faster but being limited so if there's no way to update you should implement a way to do it with Insert as an option in postgreSQL
because it makes no sense for you to have implemented this for FirebirdSQL and not for PostgreSQL.

evgeniym
Devart Team
Posts: 103
Joined: Thu 13 May 2021 07:08

Re: imUpdateOrInsert PostgreSQL ?

Post by evgeniym » Fri 18 Mar 2022 13:22

Hi,
The purpose of TUniLoader is to quickly load data into the database. And in the case of PostgreSQL, TUniLoader is implemented through the fastest mechanism - through COPY, and not through INSERT, so no options like UpdateOrInsert are provided.
At the moment, you can use the Batch Updates mechanism to perform the operations you need.
You can read more about Batch Updates here.
https://blog.devart.com/using-batch-ope ... nents.html


Regards,
Evgeniy

Post Reply