pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres
Date: Sun, 9 Apr 2023 20:16:05 -0600
Message-ID: <bd8b994f-adcf-766d-7766-2d83f0ba4139@gmail.com> (raw)
In-Reply-To: <SY4P282MB1052FA4F93997B6AD37F5CF4A6959@SY4P282MB1052.AUSP282.PROD.OUTLOOK.COM>
References: <SY4P282MB1052A434D91AC0656589B6AEA6919@SY4P282MB1052.AUSP282.PROD.OUTLOOK.COM>
	<CAH2-WzkSGmA-ZyMFu_EqQJ8tSgToj6h2=w8znTUa0Nw4oQvVHA@mail.gmail.com>
	<SY4P282MB10529BE09B553228FAA71163A6919@SY4P282MB1052.AUSP282.PROD.OUTLOOK.COM>
	<C1A7991E-251B-4422-AB4B-C1531D863036@gmail.com>
	<SY4P282MB1052FA4F93997B6AD37F5CF4A6959@SY4P282MB1052.AUSP282.PROD.OUTLOOK.COM>

On 4/9/23 19:55, Louis Tian wrote:
> Hi Alban,
>
> "I am not expecting an error here", by "here" I means when doing a TRUE UPSERT (an upsert current does not exist in Postgres).
> I am NOT referring to an "Insert on conflict do update" (which despite its intention and wide acceptance is not fully equivalent to a true upsert).
> I understand the error I am getting now is due to not null constraint given how "insert on conflict" works.
>
> An UPSERT checks whether a row exists, if so, it does an update, if not it does an insert. This is the literal definition.

This the part that's always eluded me: How does the client, the 
UPSERTer, come to hold an id and not know whether or not it's already in 
the database.






view thread (12+ messages)  latest in thread

Message-ID: <bd8b994f-adcf-766d-7766-2d83f0ba4139@gmail.com>
Permalink:  ../bd8b994f-adcf-766d-7766-2d83f0ba4139@gmail.com/
Also on:    postgresql.org/message-id/bd8b994f-adcf-766d-7766-2d83f0ba4139@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robjsargent@gmail.com
  Subject: Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres
  In-Reply-To: <bd8b994f-adcf-766d-7766-2d83f0ba4139@gmail.com>
  References: <SY4P282MB1052A434D91AC0656589B6AEA6919@SY4P282MB1052.AUSP282.PROD.OUTLOOK.COM> <CAH2-WzkSGmA-ZyMFu_EqQJ8tSgToj6h2=w8znTUa0Nw4oQvVHA@mail.gmail.com> <SY4P282MB10529BE09B553228FAA71163A6919@SY4P282MB1052.AUSP282.PROD.OUTLOOK.COM> <C1A7991E-251B-4422-AB4B-C1531D863036@gmail.com> <SY4P282MB1052FA4F93997B6AD37F5CF4A6959@SY4P282MB1052.AUSP282.PROD.OUTLOOK.COM> <bd8b994f-adcf-766d-7766-2d83f0ba4139@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox