Skip to main content
Released

UPSERT — "UPDATE or INSERT" in PostgreSQL writer

Related products:FME Form
DanAtSafe
  • DanAtSafe
    DanAtSafe

geogaard
Contributor

Include the possibilty to make use of the UPSERT function in PostgreSQL 9.5 as a feature operation in the PostgreSQL writer in FME.

This will make it possible to do an insert or an update if there is a conflict with an existing row in the table.

For more information take a look at the PostgreSQL documentation

This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • October 5, 2017

I really like this idea!! In the meantime, there is at least one workaround. Here is one pattern that I've used:

'


helmoet
Forum|alt.badge.img+8
  • May 21, 2020

Hi @aaronkoning might it be that the DatabaseJoiner not allways does a real query into the actual table? I rather would use a select count(*) as num from mytable in an SQLExecutor and after that check with a conditional value for fme_db_operation for the value of num, since that would perform for each feature arriving at the writer that a query has been done and it will be sure that an update or insert has to be done. I tried your setup, and still records were added with the same id.


  • August 14, 2020

Any updates on this? I would really love to delegate conflict resolution to the database through 'on conflict' statement


Forum|alt.badge.img

This feature would make it easy for me to support near real-time synchronization between two databases. The current work-around I am using is the Database Joiner which is more complicated to set up and adds unnecessary complexity.


geogaard
Contributor
Forum|alt.badge.img+15
  • Author
  • Contributor
  • December 16, 2021

I am looking forward to trying this out, can't wait :)


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • May 5, 2023

Should this read 2022 instead of 2021 "UPSERT is available in PostgreSQL as of FME 2021." ?

 

This article suggests it's 2022

 

https://community.safe.com/s/article/Updating-a-PostgreSQL-Database-Using-UPSERT


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings