Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres - Mailing list pgsql-general

From Francisco Olarte
Subject Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres
Date
Msg-id CA+bJJbxS8RWt=5ru9ax779Hj3Or=vnmMHni89c+UH14tSp4XYA@mail.gmail.com
Whole thread Raw
In response to Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres  (Rob Sargent <robjsargent@gmail.com>)
Responses Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres
List pgsql-general
Hi Rob:

On Mon, 10 Apr 2023 at 04:16, Rob Sargent <robjsargent@gmail.com> wrote:
> > 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.

This is extremely easy to do if you have natural instead of surrogate keys.

I work in telephony, upserting the last incoming call timestamp for a
phone number will be exactly that.

Francisco Olarte.



pgsql-general by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres
Next
From: Allan Nielsen
Date:
Subject: Re: Patroni vs pgpool II