Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-10 Thread Peter J. Holzer
On 2023-04-10 14:35:38 +0200, Karsten Hilbert wrote: > All I really wanted to hint at is that "incoming call > timestamp" may work pretty well in given settings but does > not _always_ make for a "unique enough" key. This is true for all natural primary keys: Any attribute of an entity which is

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-10 Thread Karsten Hilbert
Am Mon, Apr 10, 2023 at 01:33:41PM +0200 schrieb Francisco Olarte: > > > > 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

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-10 Thread Francisco Olarte
Hi karsten: On Mon, 10 Apr 2023 at 11:40, Karsten Hilbert wrote: > > Am Mon, Apr 10, 2023 at 09:41:15AM +0200 schrieb Francisco Olarte: > > > On Mon, 10 Apr 2023 at 04:16, Rob Sargent wrote: > > > > An UPSERT checks whether a row exists, if so, it does an update, if not > > > > it does an

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-10 Thread Karsten Hilbert
Am Mon, Apr 10, 2023 at 09:41:15AM +0200 schrieb Francisco Olarte: > On Mon, 10 Apr 2023 at 04:16, Rob Sargent 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:

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-10 Thread Francisco Olarte
Hi Rob: On Mon, 10 Apr 2023 at 04:16, Rob Sargent 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

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-10 Thread Francisco Olarte
Hi Louis: On Mon, 10 Apr 2023 at 03:05, Louis Tian wrote: > I think we need to make a distinction between an "operation" and a > "statement". OK > The concept of idempotency applies to an "operation" not an entire statement. I think I'll need a definition of both to say anything on this. >

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Adrian Klaver
On 4/9/23 19:16, Rob Sargent wrote: 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

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Rob Sargent
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

RE: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Louis Tian
NFLICT DO UPDATE is not complete equivalent to a TRUE upsert. Cheers, Louis Tian -Original Message- From: Alban Hertroys Sent: Sunday, April 9, 2023 7:26 PM To: Louis Tian Cc: Peter Geoghegan ; pgsql-general@lists.postgresql.org Subject: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

RE: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Louis Tian
abase to remain the same. Cheers, Louis Tian -Original Message- From: Francisco Olarte Sent: Sunday, April 9, 2023 7:32 PM To: Louis Tian Cc: Peter Geoghegan ; pgsql-general@lists.postgresql.org Subject: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres CAUTION: This email originated fr

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Louis Tian
It was just a question just to confirm my understanding so I got what I need, so thank you all for that. Cheers, Louis Tian From: Adrian Klaver Sent: Sunday, April 9, 2023 7:51 AM To: Louis Tian ; Peter Geoghegan Cc: pgsql-general@lists.postgresql.org Subject: [EXTERNAL]: Re: [EXTERNAL]:

Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres

2023-04-09 Thread Louis Tian
From: Israel Brewster Sent: Sunday, April 9, 2023 3:09 AM To: Louis Tian Cc: Peter Geoghegan ; pgsql-general@lists.postgresql.org Subject: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres Thanks Israel. Your example really helped me to understand where we