Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1plo0H-0002sY-LJ for pgsql-general@arkaria.postgresql.org; Mon, 10 Apr 2023 09:40:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1plo0F-000387-QH for pgsql-general@arkaria.postgresql.org; Mon, 10 Apr 2023 09:39:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1plo0F-00037w-Ef for pgsql-general@lists.postgresql.org; Mon, 10 Apr 2023 09:39:59 +0000 Received: from mout.gmx.net ([212.227.17.22]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1plo0C-001zxO-KU for pgsql-general@lists.postgresql.org; Mon, 10 Apr 2023 09:39:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1681119594; i=karsten.hilbert@gmx.net; bh=a6mBQj/5qMv5AWnoAB94OUNbdL3jwdp8tDnnLcXoAI8=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=fET7H0/e6PBIWXUvx2PQDXobPQzViLDFcfWsyDbTCCkLGQ14nERZ6KCTLhc68/+2h ni6tU3yHqe3YUAxNdsOGDKrevqIaPhwTyg3nnpOvyVOXinxrJzdgTyeDBk2tttGlUQ eJ3LI0pm7MdmB2PD1tjVx525ItjzFN2KVSRCfR7zDLQBnbhgBfz41drcH38v+GTuQO BTMMRjRv29HcwwglsqHg+Bw5s/H0ELCv0gsc6sDLv8JwMZADXgMtza8XPm8x/LzDfa M27EyGxnok5vqvKi1sqB8T1+UujT5TByJ+rwaNME2U6qgRrFMu6QDlsgcQKNTbOoRM Si8Y02U4F+KOw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from hermes ([91.9.19.226]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MD9XF-1pclRb1sQ5-009Cok for ; Mon, 10 Apr 2023 11:39:54 +0200 Received: from ncq by hermes with local (Exim 4.94.2) (envelope-from ) id 1plo09-0000nB-Ro for pgsql-general@lists.postgresql.org; Mon, 10 Apr 2023 11:39:53 +0200 Date: Mon, 10 Apr 2023 11:39:53 +0200 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: [EXTERNAL]: Re: [EXTERNAL]: Re: UPSERT in Postgres Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) Sender: X-Provags-ID: V03:K1:+TgBsTbY7wOqrr4QW8pY07wE30YWuU6JYjXEEX+4Dz/IqXVcros 9UFZPCuMP8VwtDPxzahBavJir1NL7QFVib9KUkPYuXBJah3MwRmJSBilEbI5CJr9Tp3Hius VNMf4NFfCmDIfdhkuQVPEntZvg2mH+33d3Sz75UT7SmSs6bssM94JaT/s7NIHd0S6QF0tam t6GlGPO8Bcnn7VtGf/VWg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:/0kJ+7C4kVM=;tYYOPx3BvkhvcWonmdInK6/ItWQ FBBWeizYUyDDmdRWFefdN9SDw51R1ZH1vLo18IMVew4qHE2SUUQdmu7ClV84y4V22vKJIWxvI uFrD8717vFH7O6CPyyxQgzor1Oyz+0ZjU59O8hsYRIlV/nDGyKGSERx8w40gl1IO5xCcGKV2h Aej2QJSsA5ksKT/2M/El0lELnl69QlnjnZSyJnQlDx8LALhM/0oKAPKz4JLc/4h0LXnFyaLFo JkrMIxDSz7+9o3RYqjLhG1xCs+h5KK+HMbTxzkc49/47WU+1MEMjZKBqlucIqmHbu39m35DTi fdSbL9YPcTRc1SXI2RVtlJbkXNVH8Eczkqhh7MN0+j9nkT0UdiwHD/5JMtlg+winDlSiu9u0k uonwMso95vXaMbrklSSa3ul0ezuf4+xg4QrhnlONf97UkOxwaXLNhHDt08aRS1Emgggfj8Moh kOUOXduJQ6tu8l7VcLRWbCQYllHsQbNVHw1qCkCVnQphlx9aUbfeoZMpSd1NSIk/TGb9WOzaQ NIpetS2t1F+emzQyKOBSFgnoHW84OBOK/KfE8NhoR/Psw6BdmXOefFLXRYUKu4BLY8W2y2Y78 KAcmJ965bAgxA2s78Syr3Ct+0qRVN/er/cD+z6GzYqKVCUQwTbg1kUgDe3NtY34GLH09gcBcG w9VtM/OIYp9haGWT+SIxgYt5LhDjUT6QsWGo5hjyyC+88DV4lWxYEAHKpX+HLrZZmSPV4jBXd uzIRVl8dGDmQ5it3waTbK2wjEiOSJs6oZFoplD2YlJWUdoce9lpRIufVNoTYo7ycRJxqKvVHk H1+XCBpR8tDxFMFIZ/B9CGr1ze2YoFuCtmzrKglD3OfleEsYTVQ5G0VZnx6G+nCiH5e7QZi6/ FyGxKtw7MU2p3+uvKCJNXLjD54y3QATTuYeucqANX/qtdi7GWlbcw5V5++9ZnYq0rvczC8dvC RoWkqw== Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: 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 ke= ys. > > I work in telephony, upserting the last incoming call timestamp for a > phone number will be exactly that. timezones ? DST ? spoofing ? ... Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B