Skip to main content
Released

UPSERT — "UPDATE or INSERT" in PostgreSQL writer

Related products:FME Form
siennaatsafe
nathanatsafe
danilo_fme
sigtill
+65
  • hollyatsafe
  • siennaatsafe
    siennaatsafe
  • nathanatsafe
    nathanatsafe
  • danilo_fme
    danilo_fme
  • sigtill
    sigtill
  • warrendev
    warrendev
  • tcrossman
    tcrossman
  • j.botterill
    j.botterill
  • oscard
    oscard
  • bruceharold
    bruceharold
  • fgiron
    fgiron
  • nic_ran
    nic_ran
  • jelle
    jelle
  • arnovananrooij
    arnovananrooij
  • kennyo
    kennyo
  • mark_f
  • helmoet
    helmoet
  • revesz
    revesz
  • arekpierchala
    arekpierchala
  • xav_cap
  • michaelfitzpatr
    michaelfitzpatr
  • maltaesousa
    maltaesousa
  • danielbarber
  • jonathan
  • r5
    r5
  • brent_frakes
  • chk1
    chk1
  • maryse_bucking
    maryse_bucking
  • davisblack
    davisblack
  • hallkbrdz
  • mglimsdal
    mglimsdal
  • vesnikos
  • mygis
    mygis
  • kam
  • eric.b21
  • kd
  • namanpatel
  • geogaard
    geogaard
  • roland.martin
    roland.martin
  • neilhellas
  • darkspatiallord
    darkspatiallord
  • ukrsolid
  • tono
    tono
  • anari
    anari
  • fbrws
    fbrws
  • kim
  • bmdull
  • adriano
    adriano
  • geoal
    geoal
  • jpvo
    jpvo
  • jmiddel
    jmiddel
  • jorge_vidinha
    jorge_vidinha
  • jeand
    jeand
  • kweller
    kweller
  • denniswilhelm
    denniswilhelm
  • soeren
    soeren
  • ashleym
  • ingarskogli
  • hovlandtommy
  • mariusoie1
  • geoharsha
  • rogbak
    rogbak
  • tmepple
  • denseg
  • johnbyrnejb
  • jessa
  • willd
  • arnoldvenema
  • jetgeo
  • mglimsdal_elvia

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
Contributor
Forum|alt.badge.img+17
  • Contributor
  • 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+32
  • 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